Mentions légales du service

Skip to content
Snippets Groups Projects
01_remote_actions_and_variables.ipynb 228 KiB
Newer Older
{
 "cells": [
  {
   "cell_type": "markdown",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "id": "preceding-chorus",
   "metadata": {},
   "source": [
    "# Remote actions and variables\n",
    "\n",
    "Changing the state of remote resources\n",
    "\n",
    "\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
    "---\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
    "- Website: https://discovery.gitlabpages.inria.fr/enoslib/index.html\n",
    "- Instant chat: https://framateam.org/enoslib\n",
    "---\n",
    "\n",
    "\n",
    "\n",
    "\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
    "**Prerequisites**:\n",
    "- A Grid'5000 account\n",
    "- A working EnOSlib environment and Jupyter (not included in EnOSlib dependencies, but `pip install jupyterlab` will install it)\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
    "\n"
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "id": "handed-forestry",
   "metadata": {},
   "outputs": [],
   "source": [
    "import enoslib as en\n",
    "\n",
    "# get some logging info\n",
    "import logging\n",
    "logging.basicConfig(level=logging.INFO)"
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   ]
  },
  {
   "cell_type": "markdown",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "id": "provincial-madonna",
   "metadata": {},
   "source": [
    "## Setup on Grid'5000\n",
    "\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
    "### Describing the resources\n",
    "\n",
    "For the purpose of the tutorial we'll reserve 2 nodes in the production environment.\n",
    "\n",
    "First we build a configuration object describing the wanted resources: `machines` and `networks`."
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   ]
  },
  {
   "cell_type": "code",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "execution_count": 2,
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "id": "southeast-feature",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "        <style> .enoslib {\n",
       "    width: auto;\n",
       "}\n",
       "\n",
       ".enoslib_object {\n",
       "    width: auto;\n",
       "    font-size: 1em;\n",
       "    line-height: 1.5;\n",
       "    background-color: rgb(250, 249, 249);\n",
       "    font-family: 'Segoe UI';\n",
       "    color: black;\n",
       "}\n",
       "\n",
       ".enoslib_object ul {\n",
       "    padding: 0;\n",
       "}\n",
       "\n",
       ".enoslib_object input+label {\n",
       "    margin-bottom: 0%;\n",
       "}\n",
       "\n",
       ".object_name {\n",
       "    padding: 6px 0 6px 3px;\n",
       "    border-bottom-width: 1px;\n",
       "    border-bottom-style: solid;\n",
       "    border-bottom-color: #777;\n",
       "    color: #555;\n",
       "}\n",
       "\n",
       ".object_name>div,\n",
       ".object_name>ul {\n",
       "    display: inline;\n",
       "    margin-top: 0;\n",
       "    margin-bottom: 0;\n",
       "}\n",
       "\n",
       "ul {\n",
       "    list-style: none !important;\n",
       "    padding: 3px !important;\n",
       "    margin: 0 !important;\n",
       "}\n",
       "\n",
       "input.att+label {\n",
       "    display: inline-block;\n",
       "    /*width: 140px;*/\n",
       "    color: rgb(36, 35, 35);\n",
       "    font-weight: 500;\n",
       "    padding: 4px 0 2px 0;\n",
       "}\n",
       "\n",
       "input.att:enabled+label {\n",
       "    cursor: pointer;\n",
       "    width: auto;\n",
       "}\n",
       "\n",
       "input.att {\n",
       "    display: none;\n",
       "}\n",
       "\n",
       "input.att+label:before {\n",
       "    display: inline-block;\n",
       "    content: '►';\n",
       "    font-size: 11px;\n",
       "    width: 15px;\n",
       "    text-align: center;\n",
       "}\n",
       "\n",
       "input.att:checked+label:before {\n",
       "    content: '▼';\n",
       "}\n",
       "\n",
       "input.att:disabled+label:before {\n",
       "    content: none;\n",
       "}\n",
       "\n",
       "input.att+label>span {\n",
       "    display: inline-block;\n",
       "    margin-left: 4px;\n",
       "}\n",
       "\n",
       "input.att+label>span.len {\n",
       "    font-size: small;\n",
       "}\n",
       "\n",
       "input.att:checked+label>span.len {\n",
       "    display: none;\n",
       "}\n",
       "\n",
       "label+span {\n",
       "    color: rgb(70, 69, 69);\n",
       "}\n",
       "\n",
       "input.att~ul {\n",
       "    display: none;\n",
       "}\n",
       "\n",
       "input.att:checked~ul {\n",
       "    display: block;\n",
       "}\n",
       "\n",
       "table {\n",
       "    width: auto;\n",
       "    border-collapse: collapse;\n",
       "    margin: 2%;\n",
       "}\n",
       "\n",
       "td,\n",
       "th {\n",
       "    padding: 8px;\n",
       "    height: 15px;\n",
       "    font-size: small;\n",
       "}\n",
       "\n",
       "td {\n",
       "    text-align: left !important;\n",
       "    color: rgb(160, 160, 160)\n",
       "}\n",
       "\n",
       "th {\n",
       "    text-align: center;\n",
       "    color: black;\n",
       "}\n",
       "\n",
       "input~ul {\n",
       "    position: relative;\n",
       "    left: 25px;\n",
       "}\n",
       "\n",
       "input.att~table {\n",
       "    display: none;\n",
       "}\n",
       "\n",
       "input.att:checked~table {\n",
       "    display: block;\n",
       "} </style>\n",
       "        <div class=\"enoslib\">\n",
       "        <div class=\"enoslib_object\">\n",
       "            <div class=\"object_name\">\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                &lt;class &#x27;enoslib.infra.enos_g5k.configuration.Configuration&#x27;&gt;@0x7fce1b88add0\n",
       "            </div>\n",
       "            <ul class=\"list\">\n",
       "                \n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"dhcp-f1f540f0-888a-49e2-a0fe-68c84c13685d\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"dhcp-f1f540f0-888a-49e2-a0fe-68c84c13685d\">\n",
       "            <span>dhcp</span>\n",
       "        </label>\n",
       "        <span>True</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"force_deploy-719b447b-ea5b-4806-8f0c-93ab3f241dc0\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"force_deploy-719b447b-ea5b-4806-8f0c-93ab3f241dc0\">\n",
       "            <span>force_deploy</span>\n",
       "        </label>\n",
       "        <span>False</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"env_name-37cb5a1f-c17e-4138-b9ff-a8f14fef8008\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"env_name-37cb5a1f-c17e-4138-b9ff-a8f14fef8008\">\n",
       "            <span>env_name</span>\n",
       "        </label>\n",
       "        <span>debian10-x64-nfs</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"job_name-302f4e41-4492-4c02-805b-19496c39967f\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"job_name-302f4e41-4492-4c02-805b-19496c39967f\">\n",
       "            <span>job_name</span>\n",
       "        </label>\n",
       "        <span>rsd-01</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"job_type-9fa88abf-b8d9-41cf-820e-04ee761fb68f\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"job_type-9fa88abf-b8d9-41cf-820e-04ee761fb68f\">\n",
       "            <span>job_type</span>\n",
       "        </label>\n",
       "        <span>allow_classic_ssh</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"key-f5c5e87f-7de6-43f8-9f6e-93d01b18dd00\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"key-f5c5e87f-7de6-43f8-9f6e-93d01b18dd00\">\n",
       "            <span>key</span>\n",
       "        </label>\n",
       "        <span>/home/msimonin/.ssh/id_rsa.pub</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"queue-bbdde893-49c2-412c-a90b-508455a568e6\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"queue-bbdde893-49c2-412c-a90b-508455a568e6\">\n",
       "            <span>queue</span>\n",
       "        </label>\n",
       "        <span>default</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"walltime-7a80807d-8704-4b2d-8b00-65746ff66140\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"walltime-7a80807d-8704-4b2d-8b00-65746ff66140\">\n",
       "            <span>walltime</span>\n",
       "        </label>\n",
       "        <span>02:00:00</span>\n",
       "        </li>\n",
       "                <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                    <input type=\"checkbox\" id=\"resources-b76560ff-a5d5-4152-b556-562deb0dfcba\" class=\"att\">\n",
       "                    <label for=\"resources-b76560ff-a5d5-4152-b556-562deb0dfcba\">resources <span class=\"len\">(2)</span></label>\n",
       "                    <ul id=\"resources\">\n",
       "                        \n",
       "                <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                    <input type=\"checkbox\" id=\"machines-96e512e4-a0d8-451a-8a1d-7da5c4efa388\" class=\"att\">\n",
       "                    <label for=\"machines-96e512e4-a0d8-451a-8a1d-7da5c4efa388\">machines <span class=\"len\">(2)</span></label>\n",
       "                    <ul id=\"machines\">\n",
       "                        <table><thead><tr><th>roles</th><th>primary_network</th><th>secondary_networks</th><th>cluster</th><th>nodes</th></tr></thead><tbody><tr><td><ul><li>control</li></ul></td><td>n1</td><td></td><td>parasilo</td><td>1</td></tr><tr><td><ul><li>compute</li></ul></td><td>n1</td><td></td><td>parasilo</td><td>1</td></tr></tbody></table>\n",
       "                    </ul>\n",
       "                </li>\n",
       "                \n",
       "                <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                    <input type=\"checkbox\" id=\"networks-f2b5f78a-a4e3-4099-a58c-f1c3b91467cd\" class=\"att\">\n",
       "                    <label for=\"networks-f2b5f78a-a4e3-4099-a58c-f1c3b91467cd\">networks <span class=\"len\">(1)</span></label>\n",
       "                    <ul id=\"networks\">\n",
       "                        <table><thead><tr><th>id</th><th>type</th><th>roles</th><th>site</th></tr></thead><tbody><tr><td>n1</td><td>prod</td><td><ul><li>my_network</li></ul></td><td>rennes</td></tr></tbody></table>\n",
       "                    </ul>\n",
       "                </li>\n",
       "                \n",
       "                    </ul>\n",
       "                </li>\n",
       "                \n",
       "            </ul>\n",
       "                </div>\n",
       "        </div>\n",
       "    "
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
      ],
      "text/plain": [
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "Conf@0x7fce1b88add0\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "{\n",
       "    \"dhcp\": true,\n",
       "    \"force_deploy\": false,\n",
       "    \"env_name\": \"debian10-x64-nfs\",\n",
       "    \"job_name\": \"rsd-01\",\n",
       "    \"job_type\": \"allow_classic_ssh\",\n",
       "    \"key\": \"/home/msimonin/.ssh/id_rsa.pub\",\n",
       "    \"queue\": \"default\",\n",
       "    \"walltime\": \"02:00:00\",\n",
       "    \"resources\": {\n",
       "        \"machines\": [\n",
       "            {\n",
       "                \"roles\": [\n",
       "                    \"control\"\n",
       "                ],\n",
       "                \"primary_network\": \"n1\",\n",
       "                \"secondary_networks\": [],\n",
       "                \"cluster\": \"parasilo\",\n",
       "                \"nodes\": 1\n",
       "            },\n",
       "            {\n",
       "                \"roles\": [\n",
       "                    \"compute\"\n",
       "                ],\n",
       "                \"primary_network\": \"n1\",\n",
       "                \"secondary_networks\": [],\n",
       "                \"cluster\": \"parasilo\",\n",
       "                \"nodes\": 1\n",
       "            }\n",
       "        ],\n",
       "        \"networks\": [\n",
       "            {\n",
       "                \"id\": \"n1\",\n",
       "                \"type\": \"prod\",\n",
       "                \"roles\": [\n",
       "                    \"my_network\"\n",
       "                ],\n",
       "                \"site\": \"rennes\"\n",
       "            }\n",
       "        ]\n",
       "    }\n",
       "}"
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
     "execution_count": 2,
     "metadata": {},
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
     "output_type": "execute_result"
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "source": [
    "network = en.G5kNetworkConf(id=\"n1\", type=\"prod\", roles=[\"my_network\"], site=\"rennes\")\n",
    "\n",
    "conf = (\n",
    "    en.G5kConf.from_settings(job_type=\"allow_classic_ssh\", job_name=\"rsd-01\")\n",
    "    .add_network_conf(network)\n",
    "    .add_machine(\n",
    "        roles=[\"control\"], cluster=\"parasilo\", nodes=1, primary_network=network\n",
    "    )\n",
    "    .add_machine(\n",
    "        roles=[\"compute\"],\n",
    "        cluster=\"parasilo\",\n",
    "        nodes=1,\n",
    "        primary_network=network,\n",
    "    )\n",
    "    .finalize()\n",
    ")\n",
    "conf"
   ]
  },
  {
   "cell_type": "markdown",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "id": "proprietary-cricket",
   "metadata": {},
   "source": [
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
    "### Reserving the resources\n",
    "\n",
    "We can pass the `Configuration` object to the `G5k` provider. The provider is responsible to turn the abstract resource description into a et concrete resources."
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   ]
  },
  {
   "cell_type": "code",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "execution_count": 3,
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "id": "approximate-sharp",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
     "output_type": "stream",
     "text": [
      "INFO:enoslib.infra.enos_g5k.g5k_api_utils:Reloading rsd-01 from lille\n",
      "INFO:enoslib.infra.enos_g5k.g5k_api_utils:Reloading rsd-01 from luxembourg\n",
      "INFO:enoslib.infra.enos_g5k.g5k_api_utils:Reloading rsd-01 from lyon\n",
      "INFO:enoslib.infra.enos_g5k.g5k_api_utils:Reloading rsd-01 from nancy\n",
      "INFO:enoslib.infra.enos_g5k.g5k_api_utils:Reloading rsd-01 from nantes\n",
      "INFO:enoslib.infra.enos_g5k.g5k_api_utils:Reloading rsd-01 from rennes\n",
      "INFO:enoslib.infra.enos_g5k.g5k_api_utils:Reloading rsd-01 from sophia\n",
      "INFO:enoslib.infra.enos_g5k.g5k_api_utils:Submitting {'name': 'rsd-01', 'types': ['allow_classic_ssh'], 'resources': \"{cluster='parasilo'}/nodes=1+{cluster='parasilo'}/nodes=1,walltime=02:00:00\", 'command': 'sleep 31536000', 'queue': 'default'} on rennes\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
      "INFO:enoslib.infra.enos_g5k.g5k_api_utils:Waiting for 1816344 on rennes [2021-08-27 10:00:58]\n",
      "INFO:enoslib.infra.enos_g5k.g5k_api_utils:Waiting for 1816344 on rennes [2021-08-27 10:00:58]\n",
      "INFO:enoslib.infra.enos_g5k.g5k_api_utils:All jobs are Running !\n"
     ]
    }
   ],
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "source": [
    "provider = en.G5k(conf)\n",
    "roles, networks = provider.init()"
   ]
  },
  {
   "cell_type": "markdown",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "id": "unnecessary-romantic",
   "metadata": {},
   "source": [
    "Inspecting the ressources we own for the experiment's lifetime:\n",
    "\n",
    "- roles: this is somehow a dictionnary whose keys are the role names and the associated values are the corresponding list of hosts\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
    "- networks: similar to roles bu£t for networks"
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   ]
  },
  {
   "cell_type": "code",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "execution_count": 4,
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "id": "formal-valley",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "        <style> .enoslib {\n",
       "    width: auto;\n",
       "}\n",
       "\n",
       ".enoslib_object {\n",
       "    width: auto;\n",
       "    font-size: 1em;\n",
       "    line-height: 1.5;\n",
       "    background-color: rgb(250, 249, 249);\n",
       "    font-family: 'Segoe UI';\n",
       "    color: black;\n",
       "}\n",
       "\n",
       ".enoslib_object ul {\n",
       "    padding: 0;\n",
       "}\n",
       "\n",
       ".enoslib_object input+label {\n",
       "    margin-bottom: 0%;\n",
       "}\n",
       "\n",
       ".object_name {\n",
       "    padding: 6px 0 6px 3px;\n",
       "    border-bottom-width: 1px;\n",
       "    border-bottom-style: solid;\n",
       "    border-bottom-color: #777;\n",
       "    color: #555;\n",
       "}\n",
       "\n",
       ".object_name>div,\n",
       ".object_name>ul {\n",
       "    display: inline;\n",
       "    margin-top: 0;\n",
       "    margin-bottom: 0;\n",
       "}\n",
       "\n",
       "ul {\n",
       "    list-style: none !important;\n",
       "    padding: 3px !important;\n",
       "    margin: 0 !important;\n",
       "}\n",
       "\n",
       "input.att+label {\n",
       "    display: inline-block;\n",
       "    /*width: 140px;*/\n",
       "    color: rgb(36, 35, 35);\n",
       "    font-weight: 500;\n",
       "    padding: 4px 0 2px 0;\n",
       "}\n",
       "\n",
       "input.att:enabled+label {\n",
       "    cursor: pointer;\n",
       "    width: auto;\n",
       "}\n",
       "\n",
       "input.att {\n",
       "    display: none;\n",
       "}\n",
       "\n",
       "input.att+label:before {\n",
       "    display: inline-block;\n",
       "    content: '►';\n",
       "    font-size: 11px;\n",
       "    width: 15px;\n",
       "    text-align: center;\n",
       "}\n",
       "\n",
       "input.att:checked+label:before {\n",
       "    content: '▼';\n",
       "}\n",
       "\n",
       "input.att:disabled+label:before {\n",
       "    content: none;\n",
       "}\n",
       "\n",
       "input.att+label>span {\n",
       "    display: inline-block;\n",
       "    margin-left: 4px;\n",
       "}\n",
       "\n",
       "input.att+label>span.len {\n",
       "    font-size: small;\n",
       "}\n",
       "\n",
       "input.att:checked+label>span.len {\n",
       "    display: none;\n",
       "}\n",
       "\n",
       "label+span {\n",
       "    color: rgb(70, 69, 69);\n",
       "}\n",
       "\n",
       "input.att~ul {\n",
       "    display: none;\n",
       "}\n",
       "\n",
       "input.att:checked~ul {\n",
       "    display: block;\n",
       "}\n",
       "\n",
       "table {\n",
       "    width: auto;\n",
       "    border-collapse: collapse;\n",
       "    margin: 2%;\n",
       "}\n",
       "\n",
       "td,\n",
       "th {\n",
       "    padding: 8px;\n",
       "    height: 15px;\n",
       "    font-size: small;\n",
       "}\n",
       "\n",
       "td {\n",
       "    text-align: left !important;\n",
       "    color: rgb(160, 160, 160)\n",
       "}\n",
       "\n",
       "th {\n",
       "    text-align: center;\n",
       "    color: black;\n",
       "}\n",
       "\n",
       "input~ul {\n",
       "    position: relative;\n",
       "    left: 25px;\n",
       "}\n",
       "\n",
       "input.att~table {\n",
       "    display: none;\n",
       "}\n",
       "\n",
       "input.att:checked~table {\n",
       "    display: block;\n",
       "} </style>\n",
       "        <div class=\"enoslib\">\n",
       "        <div class=\"enoslib_object\">\n",
       "            <div class=\"object_name\">\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                &lt;class &#x27;enoslib.objects.Roles&#x27;&gt;@0x7fce29eada90\n",
       "            </div>\n",
       "            <ul class=\"list\">\n",
       "                \n",
       "                <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                    <input type=\"checkbox\" id=\"control-027e1b91-a73c-43ca-826e-378033edb7b3\" class=\"att\">\n",
       "                    <label for=\"control-027e1b91-a73c-43ca-826e-378033edb7b3\">control <span class=\"len\">(1)</span></label>\n",
       "                    <ul id=\"control\">\n",
       "                        \n",
       "                <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                    <input type=\"checkbox\" id=\"parasilo-20.rennes.grid5000.fr-300070ff-11d0-4da4-800d-f2d1b92e889e\" class=\"att\">\n",
       "                    <label for=\"parasilo-20.rennes.grid5000.fr-300070ff-11d0-4da4-800d-f2d1b92e889e\">parasilo-20.rennes.grid5000.fr </label>\n",
       "                    <ul id=\"parasilo-20.rennes.grid5000.fr\">\n",
       "                        <div class=\"enoslib_object\">\n",
       "            <div class=\"object_name\">\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                &lt;class &#x27;enoslib.objects.Host&#x27;&gt;@0x7fce1ae7e690\n",
       "            </div>\n",
       "            <ul class=\"list\">\n",
       "                \n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"address-a82a614c-2bf8-492a-8da3-5fe4e9cb1674\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"address-a82a614c-2bf8-492a-8da3-5fe4e9cb1674\">\n",
       "            <span>address</span>\n",
       "        </label>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <span>parasilo-20.rennes.grid5000.fr</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"alias-d8443bc8-57cf-42f7-b8ed-629184006414\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"alias-d8443bc8-57cf-42f7-b8ed-629184006414\">\n",
       "            <span>alias</span>\n",
       "        </label>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <span>parasilo-20.rennes.grid5000.fr</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"user-fb997e74-9bea-4592-8e24-4a6494a24654\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"user-fb997e74-9bea-4592-8e24-4a6494a24654\">\n",
       "            <span>user</span>\n",
       "        </label>\n",
       "        <span>root</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"keyfile-b04a509f-a4cf-413c-b606-a0fa52f13fe7\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"keyfile-b04a509f-a4cf-413c-b606-a0fa52f13fe7\">\n",
       "            <span>keyfile</span>\n",
       "        </label>\n",
       "        <span>None</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"port-43ed4191-2cb7-4971-8aca-77ea339f6015\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"port-43ed4191-2cb7-4971-8aca-77ea339f6015\">\n",
       "            <span>port</span>\n",
       "        </label>\n",
       "        <span>None</span>\n",
       "        </li>\n",
       "                <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                    <input type=\"checkbox\" id=\"extra-881c37c7-c933-4714-b90b-2153078b8926\" class=\"att\">\n",
       "                    <label for=\"extra-881c37c7-c933-4714-b90b-2153078b8926\">extra <span class=\"len\">(0)</span></label>\n",
       "                    <ul id=\"extra\">\n",
       "                        \n",
       "                    </ul>\n",
       "                </li>\n",
       "                \n",
       "                <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                    <input type=\"checkbox\" id=\"net_devices-60b8bac2-f870-4694-b952-cbe76763ab0f\" class=\"att\">\n",
       "                    <label for=\"net_devices-60b8bac2-f870-4694-b952-cbe76763ab0f\">net_devices <span class=\"len\">(0)</span></label>\n",
       "                    <ul id=\"net_devices\">\n",
       "                        \n",
       "                    </ul>\n",
       "                </li>\n",
       "                \n",
       "            </ul>\n",
       "                </div>\n",
       "                    </ul>\n",
       "                </li>\n",
       "                \n",
       "                    </ul>\n",
       "                </li>\n",
       "                \n",
       "                <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                    <input type=\"checkbox\" id=\"compute-73cc2dde-95a8-4ebd-9c3b-325f1d168bbb\" class=\"att\">\n",
       "                    <label for=\"compute-73cc2dde-95a8-4ebd-9c3b-325f1d168bbb\">compute <span class=\"len\">(1)</span></label>\n",
       "                    <ul id=\"compute\">\n",
       "                        \n",
       "                <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                    <input type=\"checkbox\" id=\"parasilo-22.rennes.grid5000.fr-3ae44034-bca8-4c29-9b11-bbd2dee0c6e9\" class=\"att\">\n",
       "                    <label for=\"parasilo-22.rennes.grid5000.fr-3ae44034-bca8-4c29-9b11-bbd2dee0c6e9\">parasilo-22.rennes.grid5000.fr </label>\n",
       "                    <ul id=\"parasilo-22.rennes.grid5000.fr\">\n",
       "                        <div class=\"enoslib_object\">\n",
       "            <div class=\"object_name\">\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                &lt;class &#x27;enoslib.objects.Host&#x27;&gt;@0x7fce1ae7e810\n",
       "            </div>\n",
       "            <ul class=\"list\">\n",
       "                \n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"address-cde30d08-fa7c-4f98-bb99-56306006e942\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"address-cde30d08-fa7c-4f98-bb99-56306006e942\">\n",
       "            <span>address</span>\n",
       "        </label>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <span>parasilo-22.rennes.grid5000.fr</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"alias-1256986c-55f1-43c0-88ea-a7f4cfdd1999\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"alias-1256986c-55f1-43c0-88ea-a7f4cfdd1999\">\n",
       "            <span>alias</span>\n",
       "        </label>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <span>parasilo-22.rennes.grid5000.fr</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"user-e477be81-9545-4fb2-bf73-66319a8a06d4\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"user-e477be81-9545-4fb2-bf73-66319a8a06d4\">\n",
       "            <span>user</span>\n",
       "        </label>\n",
       "        <span>root</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"keyfile-75c5bb2e-3088-418e-881b-9b91c4a788ac\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"keyfile-75c5bb2e-3088-418e-881b-9b91c4a788ac\">\n",
       "            <span>keyfile</span>\n",
       "        </label>\n",
       "        <span>None</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"port-84c0ccfa-6441-4a3c-b2ed-e447291e0883\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"port-84c0ccfa-6441-4a3c-b2ed-e447291e0883\">\n",
       "            <span>port</span>\n",
       "        </label>\n",
       "        <span>None</span>\n",
       "        </li>\n",
       "                <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                    <input type=\"checkbox\" id=\"extra-cbd3917a-c6f3-4c21-aef2-378b6fc0667b\" class=\"att\">\n",
       "                    <label for=\"extra-cbd3917a-c6f3-4c21-aef2-378b6fc0667b\">extra <span class=\"len\">(0)</span></label>\n",
       "                    <ul id=\"extra\">\n",
       "                        \n",
       "                    </ul>\n",
       "                </li>\n",
       "                \n",
       "                <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                    <input type=\"checkbox\" id=\"net_devices-71444285-df95-4547-b4ff-5706192a8178\" class=\"att\">\n",
       "                    <label for=\"net_devices-71444285-df95-4547-b4ff-5706192a8178\">net_devices <span class=\"len\">(0)</span></label>\n",
       "                    <ul id=\"net_devices\">\n",
       "                        \n",
       "                    </ul>\n",
       "                </li>\n",
       "                \n",
       "            </ul>\n",
       "                </div>\n",
       "                    </ul>\n",
       "                </li>\n",
       "                \n",
       "                    </ul>\n",
       "                </li>\n",
       "                \n",
       "            </ul>\n",
       "                </div>\n",
       "        </div>\n",
       "    "
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
      ],
      "text/plain": [
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "{'control': [Host(address='parasilo-20.rennes.grid5000.fr', alias='parasilo-20.rennes.grid5000.fr', user='root', keyfile=None, port=None, extra={}, net_devices=set())], 'compute': [Host(address='parasilo-22.rennes.grid5000.fr', alias='parasilo-22.rennes.grid5000.fr', user='root', keyfile=None, port=None, extra={}, net_devices=set())]}"
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
     "execution_count": 4,
     "metadata": {},
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
     "output_type": "execute_result"
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "source": [
    "roles"
   ]
  },
  {
   "cell_type": "code",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "execution_count": 5,
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "id": "split-colombia",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "[Host(address='parasilo-20.rennes.grid5000.fr', alias='parasilo-20.rennes.grid5000.fr', user='root', keyfile=None, port=None, extra={}, net_devices=set())]"
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
     "execution_count": 5,
     "metadata": {},
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
     "output_type": "execute_result"
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "source": [
    "# list of host on a given role\n",
    "roles[\"control\"]"
   ]
  },
  {
   "cell_type": "code",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "execution_count": 6,
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "id": "owned-duration",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "        <style> .enoslib {\n",
       "    width: auto;\n",
       "}\n",
       "\n",
       ".enoslib_object {\n",
       "    width: auto;\n",
       "    font-size: 1em;\n",
       "    line-height: 1.5;\n",
       "    background-color: rgb(250, 249, 249);\n",
       "    font-family: 'Segoe UI';\n",
       "    color: black;\n",
       "}\n",
       "\n",
       ".enoslib_object ul {\n",
       "    padding: 0;\n",
       "}\n",
       "\n",
       ".enoslib_object input+label {\n",
       "    margin-bottom: 0%;\n",
       "}\n",
       "\n",
       ".object_name {\n",
       "    padding: 6px 0 6px 3px;\n",
       "    border-bottom-width: 1px;\n",
       "    border-bottom-style: solid;\n",
       "    border-bottom-color: #777;\n",
       "    color: #555;\n",
       "}\n",
       "\n",
       ".object_name>div,\n",
       ".object_name>ul {\n",
       "    display: inline;\n",
       "    margin-top: 0;\n",
       "    margin-bottom: 0;\n",
       "}\n",
       "\n",
       "ul {\n",
       "    list-style: none !important;\n",
       "    padding: 3px !important;\n",
       "    margin: 0 !important;\n",
       "}\n",
       "\n",
       "input.att+label {\n",
       "    display: inline-block;\n",
       "    /*width: 140px;*/\n",
       "    color: rgb(36, 35, 35);\n",
       "    font-weight: 500;\n",
       "    padding: 4px 0 2px 0;\n",
       "}\n",
       "\n",
       "input.att:enabled+label {\n",
       "    cursor: pointer;\n",
       "    width: auto;\n",
       "}\n",
       "\n",
       "input.att {\n",
       "    display: none;\n",
       "}\n",
       "\n",
       "input.att+label:before {\n",
       "    display: inline-block;\n",
       "    content: '►';\n",
       "    font-size: 11px;\n",
       "    width: 15px;\n",
       "    text-align: center;\n",
       "}\n",
       "\n",
       "input.att:checked+label:before {\n",
       "    content: '▼';\n",
       "}\n",
       "\n",
       "input.att:disabled+label:before {\n",
       "    content: none;\n",
       "}\n",
       "\n",
       "input.att+label>span {\n",
       "    display: inline-block;\n",
       "    margin-left: 4px;\n",
       "}\n",
       "\n",
       "input.att+label>span.len {\n",
       "    font-size: small;\n",
       "}\n",
       "\n",
       "input.att:checked+label>span.len {\n",
       "    display: none;\n",
       "}\n",
       "\n",
       "label+span {\n",
       "    color: rgb(70, 69, 69);\n",
       "}\n",
       "\n",
       "input.att~ul {\n",
       "    display: none;\n",
       "}\n",
       "\n",
       "input.att:checked~ul {\n",
       "    display: block;\n",
       "}\n",
       "\n",
       "table {\n",
       "    width: auto;\n",
       "    border-collapse: collapse;\n",
       "    margin: 2%;\n",
       "}\n",
       "\n",
       "td,\n",
       "th {\n",
       "    padding: 8px;\n",
       "    height: 15px;\n",
       "    font-size: small;\n",
       "}\n",
       "\n",
       "td {\n",
       "    text-align: left !important;\n",
       "    color: rgb(160, 160, 160)\n",
       "}\n",
       "\n",
       "th {\n",
       "    text-align: center;\n",
       "    color: black;\n",
       "}\n",
       "\n",
       "input~ul {\n",
       "    position: relative;\n",
       "    left: 25px;\n",
       "}\n",
       "\n",
       "input.att~table {\n",
       "    display: none;\n",
       "}\n",
       "\n",
       "input.att:checked~table {\n",
       "    display: block;\n",
       "} </style>\n",
       "        <div class=\"enoslib\">\n",
       "        <div class=\"enoslib_object\">\n",
       "            <div class=\"object_name\">\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                &lt;class &#x27;enoslib.objects.Host&#x27;&gt;@0x7fce1ae7e690\n",
       "            </div>\n",
       "            <ul class=\"list\">\n",
       "                \n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"address-31458927-1150-41de-adab-d0373384c329\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"address-31458927-1150-41de-adab-d0373384c329\">\n",
       "            <span>address</span>\n",
       "        </label>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <span>parasilo-20.rennes.grid5000.fr</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"alias-44b1686a-b6a2-4499-bab9-ea531a19bb8f\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"alias-44b1686a-b6a2-4499-bab9-ea531a19bb8f\">\n",
       "            <span>alias</span>\n",
       "        </label>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <span>parasilo-20.rennes.grid5000.fr</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"user-78edc58d-c2f8-4635-aabd-6a888acb4d47\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"user-78edc58d-c2f8-4635-aabd-6a888acb4d47\">\n",
       "            <span>user</span>\n",
       "        </label>\n",
       "        <span>root</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"keyfile-be8733ee-2c70-48a6-8178-6021f8530a8e\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"keyfile-be8733ee-2c70-48a6-8178-6021f8530a8e\">\n",
       "            <span>keyfile</span>\n",
       "        </label>\n",
       "        <span>None</span>\n",
       "        </li>\n",
       "        <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "        <input type=\"checkbox\" id=\"port-f0a7c6c5-d31d-402f-a845-97a4c29300ba\" class=\"att\" disabled=\"\">\n",
       "        <label for=\"port-f0a7c6c5-d31d-402f-a845-97a4c29300ba\">\n",
       "            <span>port</span>\n",
       "        </label>\n",
       "        <span>None</span>\n",
       "        </li>\n",
       "                <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                    <input type=\"checkbox\" id=\"extra-cb7f65cc-289e-4cd6-9f76-903d9a9e0e26\" class=\"att\">\n",
       "                    <label for=\"extra-cb7f65cc-289e-4cd6-9f76-903d9a9e0e26\">extra <span class=\"len\">(0)</span></label>\n",
       "                    <ul id=\"extra\">\n",
       "                        \n",
       "                    </ul>\n",
       "                </li>\n",
       "                \n",
       "                <li>\n",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "                    <input type=\"checkbox\" id=\"net_devices-bd0c3439-ccb5-42a1-95fd-87a0be142e66\" class=\"att\">\n",
       "                    <label for=\"net_devices-bd0c3439-ccb5-42a1-95fd-87a0be142e66\">net_devices <span class=\"len\">(0)</span></label>\n",
       "                    <ul id=\"net_devices\">\n",
       "                        \n",
       "                    </ul>\n",
       "                </li>\n",
       "                \n",
       "            </ul>\n",
       "                </div>\n",
       "        </div>\n",
       "    "
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
      ],
      "text/plain": [
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
       "Host(address='parasilo-20.rennes.grid5000.fr', alias='parasilo-20.rennes.grid5000.fr', user='root', keyfile=None, port=None, extra={}, net_devices=set())"
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
     "execution_count": 6,
     "metadata": {},
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
     "output_type": "execute_result"
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "source": [
    "# a single host\n",
    "roles[\"control\"][0]"
   ]
  },
  {
   "cell_type": "code",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "execution_count": 7,
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
   "id": "sacred-valuable",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
SIMONIN Matthieu's avatar
SIMONIN Matthieu committed
     "output_type": "stream",
     "text": [
      "WARNING:enoslib.infra.enos_g5k.objects:gateway is not yet implemented for <class 'enoslib.infra.enos_g5k.objects.G5kEnosProd6Network'> on the G5k side\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "        <style> .enoslib {\n",
       "    width: auto;\n",
       "}\n",
       "\n",
       ".enoslib_object {\n",
       "    width: auto;\n",
       "    font-size: 1em;\n",
       "    line-height: 1.5;\n",