ivis-mizuguchi 2 years ago
parent
commit
e2b8035598

+ 3 - 0
.gitconfig

@@ -0,0 +1,3 @@
+[user]
+	name = ivis-mizuguchi
+	email = rino.mizuguchi@ivis.co.jp

+ 3 - 0
README.md

@@ -0,0 +1,3 @@
+
+## 実験実行環境にアクセスしたい場合
+以下のリンクをクリックしてください<br>https://jupyter.cs.rcos.nii.ac.jp/user/ivis-mizuguchi-0207-ex1-bmk9tdy7/notebooks/experiment.ipynb

+ 1 - 2
WORKFLOW/images/notebooks.diag

@@ -31,12 +31,11 @@
                     "enter_metadata";
                     "save";
                     "finish";
-                    "experiment_on_mdx";
                 }
             }
         }
 
         "0. 実験ワークフロー実行準備" -> "1. 実験ワークフロー";
-        "enter_metadata","save","experiment_on_mdx" -> "finish";
+        "enter_metadata","save" -> "finish";
 
     }

+ 102 - 0
WORKFLOW/images/notebooks.svg

@@ -0,0 +1,102 @@
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:inkspace="http://www.inkscape.org/namespaces/inkscape" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 946 595">
+  <defs id="defs_block">
+    <filter height="1.504" id="filter_blur" inkspace:collect="always" width="1.1575" x="-0.07875" y="-0.252">
+      <feGaussianBlur id="feGaussianBlur3780" inkspace:collect="always" stdDeviation="4.2"/>
+    </filter>
+  </defs>
+  <title>blockdiag</title>
+  <desc>
+   blockdiag {
+    node_width = 230;
+    node_height = 145;
+
+        group {
+            orientation = portrait;
+            shape = line;
+            style = none;
+
+            group {
+                shape = line;
+                style = none;
+                orientation = portrait;
+                group {
+                    orientation = portrait;
+                    color = "#ffeed9";
+                    "0. &#23455;&#39443;&#12527;&#12540;&#12463;&#12501;&#12525;&#12540;&#23455;&#34892;&#28310;&#20633;"[label = "0. &#23455;&#39443;&#12527;&#12540;&#12463;&#12501;&#12525;&#12540;&#23455;&#34892;&#28310;&#20633;", fontsize = 14];
+                    "required_every_time";
+                }
+            }
+
+            group {
+                shape = line;
+                style = none;
+                orientation = portrait;
+                group {
+                    orientation = portrait;
+                    color = "#fcdcb1";
+                    "1. &#23455;&#39443;&#12527;&#12540;&#12463;&#12501;&#12525;&#12540;"[label = "1. &#23455;&#39443;&#12527;&#12540;&#12463;&#12501;&#12525;&#12540;", fontsize = 14];
+                    "enter_metadata";
+                    "save";
+                    "finish";
+                }
+            }
+        }
+
+        "0. &#23455;&#39443;&#12527;&#12540;&#12463;&#12501;&#12525;&#12540;&#23455;&#34892;&#28310;&#20633;" -&gt; "1. &#23455;&#39443;&#12527;&#12540;&#12463;&#12501;&#12525;&#12540;";
+        "enter_metadata","save" -&gt; "finish";
+
+    }
+</desc>
+  <rect fill="rgb(255,238,217)" height="165" style="filter:url(#filter_blur)" width="540" x="56" y="30"/>
+  <rect fill="rgb(252,220,177)" height="350" style="filter:url(#filter_blur)" width="834" x="56" y="215"/>
+  <rect fill="rgb(0,0,0)" height="145" stroke="rgb(0,0,0)" style="filter:url(#filter_blur);opacity:0.7;fill-opacity:1" width="230" x="67" y="46"/>
+  <rect fill="rgb(0,0,0)" height="145" stroke="rgb(0,0,0)" style="filter:url(#filter_blur);opacity:0.7;fill-opacity:1" width="230" x="361" y="46"/>
+  <rect fill="rgb(0,0,0)" height="145" stroke="rgb(0,0,0)" style="filter:url(#filter_blur);opacity:0.7;fill-opacity:1" width="230" x="67" y="231"/>
+  <rect fill="rgb(0,0,0)" height="145" stroke="rgb(0,0,0)" style="filter:url(#filter_blur);opacity:0.7;fill-opacity:1" width="230" x="361" y="231"/>
+  <rect fill="rgb(0,0,0)" height="145" stroke="rgb(0,0,0)" style="filter:url(#filter_blur);opacity:0.7;fill-opacity:1" width="230" x="655" y="231"/>
+  <rect fill="rgb(0,0,0)" height="145" stroke="rgb(0,0,0)" style="filter:url(#filter_blur);opacity:0.7;fill-opacity:1" width="230" x="361" y="416"/>
+  <rect fill="rgb(255,255,255)" height="145" stroke="rgb(0,0,0)" width="230" x="64" y="40"/>
+  <text fill="rgb(0,0,0)" font-family="sans-serif" font-size="14" font-style="normal" font-weight="normal" text-anchor="middle" textLength="189" x="179.5" y="120">0. &#23455;&#39443;&#12527;&#12540;&#12463;&#12501;&#12525;&#12540;&#23455;&#34892;&#28310;&#20633;</text>
+  <rect fill="rgb(255,255,255)" height="145" stroke="rgb(0,0,0)" width="230" x="358" y="40"/>
+  <text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="360" width="226" y="140">6. &#23455;&#34892;&#32080;&#26524;&#12434;&#23455;&#39443;&#12522;&#12509;&#12472;&#12488;&#12522;&#12395;&#21516;&#26399;&#12377;&#12427;</text><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="360" width="226" y="129">5. &#39640;&#24615;&#33021;&#23455;&#39443;&#29872;&#22659;&#21033;&#29992;&#12398;&#12383;&#12417;&#12395;&#24517;&#35201;&#12394;&#35373;&#23450;&#12434;&#12377;&#12427;</text><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="360" width="226" y="118">4. &#12487;&#12540;&#12479;&#21516;&#26399;&#12398;&#12383;&#12417;&#12398;&#35373;&#23450;&#12434;&#12377;&#12427;</text><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="360" width="226" y="107">3. &#12518;&#12540;&#12470;&#12540;&#35469;&#35388;&#12434;&#34892;&#12358;</text><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="360" width="226" y="96">2. README&#12395;&#23455;&#39443;&#23455;&#34892;&#29872;&#22659;&#12408;&#12398;&#12522;&#12531;&#12463;&#12434;&#36861;&#21152;&#12377;&#12427;</text><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="360" width="226" y="85">1. Git&#31649;&#29702;&#23550;&#35937;&#22806;&#12501;&#12449;&#12452;&#12523;&#12434;.gitignore&#12391;&#35373;&#23450;&#12377;&#12427;</text><a xlink:href="WORKFLOW/util/required_every_time.ipynb"><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="11" font-style="normal" font-weight="bold" font-anchor="middle" x="360" width="226" y="62">&#24517;&#35201;&#12394;&#28310;&#20633;&#12434;&#34892;&#12358;</text></a><rect fill="rgb(255,255,255)" height="145" stroke="rgb(0,0,0)" width="230" x="64" y="225"/>
+  <text fill="rgb(0,0,0)" font-family="sans-serif" font-size="14" font-style="normal" font-weight="normal" text-anchor="middle" textLength="133" x="179.5" y="305">1. &#23455;&#39443;&#12527;&#12540;&#12463;&#12501;&#12525;&#12540;</text>
+  <rect fill="rgb(255,255,255)" height="145" stroke="rgb(0,0,0)" width="230" x="358" y="225"/>
+  <text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="360" width="226" y="292">3. &#23455;&#34892;&#32080;&#26524;&#12434;&#12487;&#12540;&#12479;&#12460;&#12496;&#12490;&#12531;&#12473;&#27231;&#33021;&#12395;&#21516;&#26399;&#12377;&#12427;</text><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="360" width="226" y="281">2.&#12513;&#12479;&#24773;&#22577;&#12434;&#12501;&#12449;&#12452;&#12523;&#12395;&#20445;&#23384;&#12377;&#12427;</text><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="360" width="226" y="270">1. &#12513;&#12479;&#12487;&#12540;&#12479;&#12434;&#20837;&#21147;&#12377;&#12427;</text><a xlink:href="WORKFLOW/enter_metadata.ipynb"><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="11" font-style="normal" font-weight="bold" font-anchor="middle" x="360" width="226" y="247">&#23455;&#39443;&#12513;&#12479;&#12487;&#12540;&#12479;&#12434;&#20837;&#21147;&#12377;&#12427;</text></a><rect fill="rgb(255,255,255)" height="145" stroke="rgb(0,0,0)" width="230" x="652" y="225"/>
+  <text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="654" width="226" y="292">3. &#36884;&#20013;&#20445;&#23384;&#12377;&#12427;</text><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="654" width="226" y="281">2. &#39640;&#24615;&#33021;&#23455;&#39443;&#29872;&#22659;&#12363;&#12425;&#23455;&#39443;&#35352;&#37682;&#12434;&#21462;&#24471;&#12377;&#12427;</text><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="654" width="226" y="270">1. &#12467;&#12511;&#12483;&#12488;&#12513;&#12483;&#12475;&#12540;&#12472;&#12434;&#22793;&#25968;&#12395;&#20837;&#21147;&#12377;&#12427;</text><a xlink:href="WORKFLOW/save.ipynb"><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="11" font-style="normal" font-weight="bold" font-anchor="middle" x="654" width="226" y="247">&#23455;&#39443;&#12434;&#36884;&#20013;&#20445;&#23384;&#12377;&#12427;</text></a><rect fill="rgb(255,255,255)" height="145" stroke="rgb(0,0,0)" width="230" x="358" y="410"/>
+  <text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="360" width="226" y="477">3. &#23455;&#39443;&#35352;&#37682;&#12434;&#12487;&#12540;&#12479;&#12460;&#12496;&#12490;&#12531;&#12473;&#27231;&#33021;&#12395;&#21516;&#26399;&#12377;&#12427;</text><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="360" width="226" y="466">2. &#39640;&#24615;&#33021;&#23455;&#39443;&#29872;&#22659;&#12363;&#12425;&#23455;&#39443;&#35352;&#37682;&#12434;&#21462;&#24471;&#12377;&#12427;</text><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="9" font-style="normal" font-weight="normal" font-anchor="middle" x="360" width="226" y="455">1.&#23455;&#34892;&#29872;&#22659;&#27083;&#25104;&#12434;&#35352;&#37682;&#12377;&#12427;</text><a xlink:href="WORKFLOW/finish.ipynb"><text fill="rgb(0,0,0)" font-family="sans-serif" font-size="11" font-style="normal" font-weight="bold" font-anchor="middle" x="360" width="226" y="432">&#23455;&#39443;&#12434;&#32066;&#20102;&#12377;&#12427;</text></a><path d="M 179 185 L 179 217" fill="none" stroke="rgb(0,0,0)"/>
+  <polygon fill="rgb(0,0,0)" points="179,224 175,217 183,217 179,224" stroke="rgb(0,0,0)"/>
+  <path d="M 179 185 L 179 217" fill="none" stroke="rgb(0,0,0)"/>
+  <polygon fill="rgb(0,0,0)" points="179,224 175,217 183,217 179,224" stroke="rgb(0,0,0)"/>
+  <path d="M 473 370 L 473 402" fill="none" stroke="rgb(0,0,0)"/>
+  <polygon fill="rgb(0,0,0)" points="473,409 469,402 477,402 473,409" stroke="rgb(0,0,0)"/>
+  <path d="M 767 370 L 767 390" fill="none" stroke="rgb(0,0,0)"/>
+  <path d="M 473 390 L 767 390" fill="none" stroke="rgb(0,0,0)"/>
+  <path d="M 473 390 L 473 402" fill="none" stroke="rgb(0,0,0)"/>
+  <polygon fill="rgb(0,0,0)" points="473,409 469,402 477,402 473,409" stroke="rgb(0,0,0)"/>
+  <path d="M 473 370 L 473 402" fill="none" stroke="rgb(0,0,0)"/>
+  <polygon fill="rgb(0,0,0)" points="473,409 469,402 477,402 473,409" stroke="rgb(0,0,0)"/>
+  <path d="M 767 370 L 767 390" fill="none" stroke="rgb(0,0,0)"/>
+  <path d="M 473 390 L 767 390" fill="none" stroke="rgb(0,0,0)"/>
+  <path d="M 473 390 L 473 402" fill="none" stroke="rgb(0,0,0)"/>
+  <polygon fill="rgb(0,0,0)" points="473,409 469,402 477,402 473,409" stroke="rgb(0,0,0)"/>
+  <path d="M 179 185 L 179 217" fill="none" stroke="rgb(0,0,0)"/>
+  <polygon fill="rgb(0,0,0)" points="179,224 175,217 183,217 179,224" stroke="rgb(0,0,0)"/>
+  <path d="M 179 185 L 179 217" fill="none" stroke="rgb(0,0,0)"/>
+  <polygon fill="rgb(0,0,0)" points="179,224 175,217 183,217 179,224" stroke="rgb(0,0,0)"/>
+  <path d="M 473 370 L 473 402" fill="none" stroke="rgb(0,0,0)"/>
+  <polygon fill="rgb(0,0,0)" points="473,409 469,402 477,402 473,409" stroke="rgb(0,0,0)"/>
+  <path d="M 767 370 L 767 390" fill="none" stroke="rgb(0,0,0)"/>
+  <path d="M 473 390 L 767 390" fill="none" stroke="rgb(0,0,0)"/>
+  <path d="M 473 390 L 473 402" fill="none" stroke="rgb(0,0,0)"/>
+  <polygon fill="rgb(0,0,0)" points="473,409 469,402 477,402 473,409" stroke="rgb(0,0,0)"/>
+  <path d="M 473 370 L 473 402" fill="none" stroke="rgb(0,0,0)"/>
+  <polygon fill="rgb(0,0,0)" points="473,409 469,402 477,402 473,409" stroke="rgb(0,0,0)"/>
+  <path d="M 767 370 L 767 390" fill="none" stroke="rgb(0,0,0)"/>
+  <path d="M 473 390 L 767 390" fill="none" stroke="rgb(0,0,0)"/>
+  <path d="M 473 390 L 473 402" fill="none" stroke="rgb(0,0,0)"/>
+  <polygon fill="rgb(0,0,0)" points="473,409 469,402 477,402 473,409" stroke="rgb(0,0,0)"/>
+  <rect fill="none" height="535" stroke="rgb(243,152,0)" stroke-dasharray="0 196605" stroke-width="3" width="834" x="56" y="30"/>
+  <rect fill="none" height="165" stroke="rgb(243,152,0)" stroke-dasharray="0 196605" stroke-width="3" width="540" x="56" y="30"/>
+  <rect fill="none" height="350" stroke="rgb(243,152,0)" stroke-dasharray="0 196605" stroke-width="3" width="834" x="56" y="215"/>
+</svg>

+ 168 - 20
WORKFLOW/util/required_every_time.ipynb

@@ -21,9 +21,15 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 1,
    "id": "f2cc773c",
-   "metadata": {},
+   "metadata": {
+    "deletable": false,
+    "editable": false,
+    "run_through_control": {
+     "frozen": true
+    }
+   },
    "outputs": [],
    "source": [
     "%%sh\n",
@@ -58,10 +64,24 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 2,
    "id": "2eb51aba",
-   "metadata": {},
-   "outputs": [],
+   "metadata": {
+    "deletable": false,
+    "editable": false,
+    "run_through_control": {
+     "frozen": true
+    }
+   },
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "/home/jovyan\n"
+     ]
+    }
+   ],
    "source": [
     "import os\n",
     "%cd ~/\n",
@@ -82,12 +102,21 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 5,
    "id": "bf28557d",
    "metadata": {},
-   "outputs": [],
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "/home/jovyan/WORKFLOW/util/scripts\n",
+      "{'siblings': {'ginHttp': 'http://dg02.dg.rcos.nii.ac.jp/', 'ginSsh': 'ssh://root@dg02.dg.rcos.nii.ac.jp:3001/', 'gitHugibHttp': 'https://github.com/', 'gitHubSsh': 'git@github.com:'}, 'rcosBinderUrl': 'https://jupyter.cs.rcos.nii.ac.jp'}\n"
+     ]
+    }
+   ],
    "source": [
-    "%cd ~/WORKFLOW/scripts\n",
+    "%cd ~/WORKFLOW/util/scripts\n",
     "import json\n",
     "from scripts import utils\n",
     "\n",
@@ -158,10 +187,41 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 6,
    "id": "e277f2c2",
-   "metadata": {},
-   "outputs": [],
+   "metadata": {
+    "deletable": false,
+    "editable": false,
+    "run_through_control": {
+     "frozen": true
+    }
+   },
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Generating public/private ed25519 key pair.\n",
+      "Created directory '/home/jovyan/.ssh'.\n",
+      "Your identification has been saved in /home/jovyan/.ssh/id_ed25519\n",
+      "Your public key has been saved in /home/jovyan/.ssh/id_ed25519.pub\n",
+      "The key fingerprint is:\n",
+      "SHA256:Ppiic5BrfseooKUjTU1es5rOmuViltMZfs/BKLV4wzQ jovyan@jupyter-ivis-2dmizuguchi-2d0207-2dex1-2dbmk9tdy7\n",
+      "The key's randomart image is:\n",
+      "+--[ED25519 256]--+\n",
+      "|                 |\n",
+      "|                 |\n",
+      "|                 |\n",
+      "|    . o          |\n",
+      "|   = .EoS        |\n",
+      "|  + +=.O         |\n",
+      "|.o.*=BO =        |\n",
+      "|++@*X++o o       |\n",
+      "|+**X+o .o        |\n",
+      "+----[SHA256]-----+\n"
+     ]
+    }
+   ],
    "source": [
     "%%bash\n",
     "#!/bin/bash\n",
@@ -179,10 +239,27 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 8,
    "id": "03dc3f22",
-   "metadata": {},
-   "outputs": [],
+   "metadata": {
+    "deletable": false,
+    "editable": false,
+    "run_through_control": {
+     "frozen": true
+    }
+   },
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "/home/jovyan\n",
+      "[INFO   ] Creating a new annex repo at /home/jovyan \n",
+      "\u001b[1;1mcreate\u001b[0m(\u001b[1;32mok\u001b[0m): /home/jovyan (\u001b[1;35mdataset\u001b[0m)\n",
+      "\u001b[0m"
+     ]
+    }
+   ],
    "source": [
     "%cd ~/\n",
     "!datalad create --force ."
@@ -363,10 +440,29 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 9,
    "id": "d12d4375",
-   "metadata": {},
-   "outputs": [],
+   "metadata": {
+    "deletable": false,
+    "editable": false,
+    "run_through_control": {
+     "frozen": true
+    }
+   },
+   "outputs": [
+    {
+     "data": {
+      "application/javascript": [
+       "IPython.notebook.save_checkpoint();"
+      ],
+      "text/plain": [
+       "<IPython.core.display.Javascript object>"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    }
+   ],
    "source": [
     "from IPython.display import display, Javascript\n",
     "display(Javascript('IPython.notebook.save_checkpoint();'))"
@@ -374,9 +470,15 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 10,
    "id": "7b237228",
-   "metadata": {},
+   "metadata": {
+    "deletable": false,
+    "editable": false,
+    "run_through_control": {
+     "frozen": true
+    }
+   },
    "outputs": [],
    "source": [
     "# SSHホスト(=GIN)を信頼する設定\n",
@@ -385,6 +487,52 @@
     "    f.write('host dg02.dg.rcos.nii.ac.jp\\n\\tStrictHostKeyChecking no\\n\\tUserKnownHostsFile=/dev/null\\n')"
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": 11,
+   "id": "ce6440d7",
+   "metadata": {
+    "deletable": false,
+    "editable": false,
+    "run_through_control": {
+     "frozen": true
+    }
+   },
+   "outputs": [],
+   "source": [
+    "# SSHホスト(=GIN)を信頼する設定\n",
+    "# ドメイン名がハードコーディングにつき要修正\n",
+    "with open('/home/jovyan/.ssh/config', mode='w') as f:\n",
+    "    f.write('host gin.g-node.org\\n\\tStrictHostKeyChecking no\\n\\tUserKnownHostsFile=/dev/null\\n')"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 12,
+   "id": "3a34981b",
+   "metadata": {
+    "deletable": false,
+    "editable": false,
+    "run_through_control": {
+     "frozen": true
+    }
+   },
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "^C\r\n",
+      "ERROR: \r\n",
+      "Interrupted by user while doing magic: KeyboardInterrupt()\r\n",
+      "\u001b[0m"
+     ]
+    }
+   ],
+   "source": [
+    "!datalad siblings add -s gin --url git@gin.g-node.org:/ivis-mizuguchi/0207-ex1.git"
+   ]
+  },
   {
    "cell_type": "code",
    "execution_count": null,
@@ -416,7 +564,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.7.10"
+   "version": "3.9.7"
   }
  },
  "nbformat": 4,

BIN
WORKFLOW/util/scripts/__pycache__/utils.cpython-39.pyc


+ 6 - 11
WORKFLOW/util/scripts/nb_utils.py

@@ -101,16 +101,14 @@ def load_json(PATH):
 def generate_svg_diag(
         output='WORKFLOW/images/notebooks.svg',
         diag='WORKFLOW/images/notebooks.diag',
-        dir_util='WORKFLOW/FLOW/util',
-        dir_01='WORKFLOW/FLOW/01_preparation_phase',
-        dir_02='WORKFLOW/FLOW/02_experimental_phase',
-        dir_03='WORKFLOW/FLOW/03_after_research_phase',
         font='.fonts/ipag.ttf',
+        dir_util='WORKFLOW/util',
+        dir_experiment='WORKFLOW',
 ):
     with TemporaryDirectory() as workdir:
         skeleton = Path(workdir) / 'skeleton.svg'
         _generate_skeleton(skeleton, Path(diag), Path(font))
-        _embed_detail_information(Path(output), skeleton, Path(dir_util), Path(dir_01), Path(dir_02), Path(dir_03))
+        _embed_detail_information(Path(output), skeleton, Path(dir_util), Path(dir_experiment))
         return output
 
 def _generate_skeleton(output, diag, font):
@@ -123,12 +121,10 @@ def setup_python_path():
     if lib_path not in sys.path:
         sys.path.append(lib_path)
 
-def _embed_detail_information(output, skeleton, dir_util, dir_01, dir_02, dir_03):
+def _embed_detail_information(output, skeleton, dir_util, dir_experiment):
     # Notebookのヘッダ取得
     nb_headers = _get_notebook_headers(dir_util)
-    nb_headers.update(_get_notebook_headers(dir_01))
-    nb_headers.update(_get_notebook_headers(dir_02))
-    nb_headers.update(_get_notebook_headers(dir_03))
+    nb_headers.update(_get_notebook_headers(dir_experiment))
 
     # 雛形の読み込み
     tree = etree.parse(str(skeleton))
@@ -137,7 +133,7 @@ def _embed_detail_information(output, skeleton, dir_util, dir_01, dir_02, dir_03
     for elem in list(tree.findall(SVG_TEXT)):
         if _is_target_rect(elem, nb_headers.keys()):
             nb_name = _find_matching_notebook(nb_headers.keys(), elem.text)
-            _embed_info_in_one_rect(elem, nb_headers, Path('WORKFLOW/FLOW'), nb_name)
+            _embed_info_in_one_rect(elem, nb_headers, Path('WORKFLOW'), nb_name)
 
     # SVGの保存
     output.parent.mkdir(parents=True, exist_ok=True)
@@ -159,7 +155,6 @@ def _find_matching_notebook(notebooks, title):
 def _embed_info_in_one_rect(elem, nb_headers, nb_dir, nb_name):
     headers = nb_headers[nb_name]
     nb_file = nb_headers[nb_name]['path']
-    nb_file = nb_file.replace('WORKFLOW/FLOW/', '')
     rect_elem = elem.getprevious()
     rect = (
         (int(rect_elem.attrib['x']), int(rect_elem.attrib['y'])),

+ 134 - 7
experiment.ipynb

@@ -11,7 +11,6 @@
    ]
   },
   {
-   "attachments": {},
    "cell_type": "markdown",
    "metadata": {},
    "source": [
@@ -93,15 +92,143 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 2,
    "metadata": {},
-   "outputs": [],
+   "outputs": [
+    {
+     "data": {
+      "image/svg+xml": [
+       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:inkspace=\"http://www.inkscape.org/namespaces/inkscape\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 946 595\">\n",
+       "  <defs id=\"defs_block\">\n",
+       "    <filter height=\"1.504\" id=\"filter_blur\" inkspace:collect=\"always\" width=\"1.1575\" x=\"-0.07875\" y=\"-0.252\">\n",
+       "      <feGaussianBlur id=\"feGaussianBlur3780\" inkspace:collect=\"always\" stdDeviation=\"4.2\"/>\n",
+       "    </filter>\n",
+       "  </defs>\n",
+       "  <title>blockdiag</title>\n",
+       "  <desc>\n",
+       "   blockdiag {\n",
+       "    node_width = 230;\n",
+       "    node_height = 145;\n",
+       "\n",
+       "        group {\n",
+       "            orientation = portrait;\n",
+       "            shape = line;\n",
+       "            style = none;\n",
+       "\n",
+       "            group {\n",
+       "                shape = line;\n",
+       "                style = none;\n",
+       "                orientation = portrait;\n",
+       "                group {\n",
+       "                    orientation = portrait;\n",
+       "                    color = &quot;#ffeed9&quot;;\n",
+       "                    &quot;0. 実験ワークフロー実行準備&quot;[label = &quot;0. 実験ワークフロー実行準備&quot;, fontsize = 14];\n",
+       "                    &quot;required_every_time&quot;;\n",
+       "                }\n",
+       "            }\n",
+       "\n",
+       "            group {\n",
+       "                shape = line;\n",
+       "                style = none;\n",
+       "                orientation = portrait;\n",
+       "                group {\n",
+       "                    orientation = portrait;\n",
+       "                    color = &quot;#fcdcb1&quot;;\n",
+       "                    &quot;1. 実験ワークフロー&quot;[label = &quot;1. 実験ワークフロー&quot;, fontsize = 14];\n",
+       "                    &quot;enter_metadata&quot;;\n",
+       "                    &quot;save&quot;;\n",
+       "                    &quot;finish&quot;;\n",
+       "                }\n",
+       "            }\n",
+       "        }\n",
+       "\n",
+       "        &quot;0. 実験ワークフロー実行準備&quot; -&gt; &quot;1. 実験ワークフロー&quot;;\n",
+       "        &quot;enter_metadata&quot;,&quot;save&quot; -&gt; &quot;finish&quot;;\n",
+       "\n",
+       "    }\n",
+       "</desc>\n",
+       "  <rect fill=\"rgb(255,238,217)\" height=\"165\" style=\"filter:url(#filter_blur)\" width=\"540\" x=\"56\" y=\"30\"/>\n",
+       "  <rect fill=\"rgb(252,220,177)\" height=\"350\" style=\"filter:url(#filter_blur)\" width=\"834\" x=\"56\" y=\"215\"/>\n",
+       "  <rect fill=\"rgb(0,0,0)\" height=\"145\" stroke=\"rgb(0,0,0)\" style=\"filter:url(#filter_blur);opacity:0.7;fill-opacity:1\" width=\"230\" x=\"67\" y=\"46\"/>\n",
+       "  <rect fill=\"rgb(0,0,0)\" height=\"145\" stroke=\"rgb(0,0,0)\" style=\"filter:url(#filter_blur);opacity:0.7;fill-opacity:1\" width=\"230\" x=\"361\" y=\"46\"/>\n",
+       "  <rect fill=\"rgb(0,0,0)\" height=\"145\" stroke=\"rgb(0,0,0)\" style=\"filter:url(#filter_blur);opacity:0.7;fill-opacity:1\" width=\"230\" x=\"67\" y=\"231\"/>\n",
+       "  <rect fill=\"rgb(0,0,0)\" height=\"145\" stroke=\"rgb(0,0,0)\" style=\"filter:url(#filter_blur);opacity:0.7;fill-opacity:1\" width=\"230\" x=\"361\" y=\"231\"/>\n",
+       "  <rect fill=\"rgb(0,0,0)\" height=\"145\" stroke=\"rgb(0,0,0)\" style=\"filter:url(#filter_blur);opacity:0.7;fill-opacity:1\" width=\"230\" x=\"655\" y=\"231\"/>\n",
+       "  <rect fill=\"rgb(0,0,0)\" height=\"145\" stroke=\"rgb(0,0,0)\" style=\"filter:url(#filter_blur);opacity:0.7;fill-opacity:1\" width=\"230\" x=\"361\" y=\"416\"/>\n",
+       "  <rect fill=\"rgb(255,255,255)\" height=\"145\" stroke=\"rgb(0,0,0)\" width=\"230\" x=\"64\" y=\"40\"/>\n",
+       "  <text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"14\" font-style=\"normal\" font-weight=\"normal\" text-anchor=\"middle\" textLength=\"189\" x=\"179.5\" y=\"120\">0. 実験ワークフロー実行準備</text>\n",
+       "  <rect fill=\"rgb(255,255,255)\" height=\"145\" stroke=\"rgb(0,0,0)\" width=\"230\" x=\"358\" y=\"40\"/>\n",
+       "  <text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"140\">6. 実行結果を実験リポジトリに同期する</text><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"129\">5. 高性能実験環境利用のために必要な設定をする</text><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"118\">4. データ同期のための設定をする</text><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"107\">3. ユーザー認証を行う</text><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"96\">2. READMEに実験実行環境へのリンクを追加する</text><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"85\">1. Git管理対象外ファイルを.gitignoreで設定する</text><a xlink:href=\"WORKFLOW/util/required_every_time.ipynb\"><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"11\" font-style=\"normal\" font-weight=\"bold\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"62\">必要な準備を行う</text></a><rect fill=\"rgb(255,255,255)\" height=\"145\" stroke=\"rgb(0,0,0)\" width=\"230\" x=\"64\" y=\"225\"/>\n",
+       "  <text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"14\" font-style=\"normal\" font-weight=\"normal\" text-anchor=\"middle\" textLength=\"133\" x=\"179.5\" y=\"305\">1. 実験ワークフロー</text>\n",
+       "  <rect fill=\"rgb(255,255,255)\" height=\"145\" stroke=\"rgb(0,0,0)\" width=\"230\" x=\"358\" y=\"225\"/>\n",
+       "  <text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"292\">3. 実行結果をデータガバナンス機能に同期する</text><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"281\">2.メタ情報をファイルに保存する</text><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"270\">1. メタデータを入力する</text><a xlink:href=\"WORKFLOW/enter_metadata.ipynb\"><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"11\" font-style=\"normal\" font-weight=\"bold\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"247\">実験メタデータを入力する</text></a><rect fill=\"rgb(255,255,255)\" height=\"145\" stroke=\"rgb(0,0,0)\" width=\"230\" x=\"652\" y=\"225\"/>\n",
+       "  <text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"654\" width=\"226\" y=\"292\">3. 途中保存する</text><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"654\" width=\"226\" y=\"281\">2. 高性能実験環境から実験記録を取得する</text><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"654\" width=\"226\" y=\"270\">1. コミットメッセージを変数に入力する</text><a xlink:href=\"WORKFLOW/save.ipynb\"><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"11\" font-style=\"normal\" font-weight=\"bold\" font-anchor=\"middle\" x=\"654\" width=\"226\" y=\"247\">実験を途中保存する</text></a><rect fill=\"rgb(255,255,255)\" height=\"145\" stroke=\"rgb(0,0,0)\" width=\"230\" x=\"358\" y=\"410\"/>\n",
+       "  <text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"477\">3. 実験記録をデータガバナンス機能に同期する</text><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"466\">2. 高性能実験環境から実験記録を取得する</text><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"9\" font-style=\"normal\" font-weight=\"normal\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"455\">1.実行環境構成を記録する</text><a xlink:href=\"WORKFLOW/finish.ipynb\"><text fill=\"rgb(0,0,0)\" font-family=\"sans-serif\" font-size=\"11\" font-style=\"normal\" font-weight=\"bold\" font-anchor=\"middle\" x=\"360\" width=\"226\" y=\"432\">実験を終了する</text></a><path d=\"M 179 185 L 179 217\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <polygon fill=\"rgb(0,0,0)\" points=\"179,224 175,217 183,217 179,224\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 179 185 L 179 217\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <polygon fill=\"rgb(0,0,0)\" points=\"179,224 175,217 183,217 179,224\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 473 370 L 473 402\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <polygon fill=\"rgb(0,0,0)\" points=\"473,409 469,402 477,402 473,409\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 767 370 L 767 390\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 473 390 L 767 390\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 473 390 L 473 402\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <polygon fill=\"rgb(0,0,0)\" points=\"473,409 469,402 477,402 473,409\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 473 370 L 473 402\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <polygon fill=\"rgb(0,0,0)\" points=\"473,409 469,402 477,402 473,409\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 767 370 L 767 390\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 473 390 L 767 390\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 473 390 L 473 402\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <polygon fill=\"rgb(0,0,0)\" points=\"473,409 469,402 477,402 473,409\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 179 185 L 179 217\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <polygon fill=\"rgb(0,0,0)\" points=\"179,224 175,217 183,217 179,224\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 179 185 L 179 217\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <polygon fill=\"rgb(0,0,0)\" points=\"179,224 175,217 183,217 179,224\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 473 370 L 473 402\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <polygon fill=\"rgb(0,0,0)\" points=\"473,409 469,402 477,402 473,409\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 767 370 L 767 390\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 473 390 L 767 390\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 473 390 L 473 402\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <polygon fill=\"rgb(0,0,0)\" points=\"473,409 469,402 477,402 473,409\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 473 370 L 473 402\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <polygon fill=\"rgb(0,0,0)\" points=\"473,409 469,402 477,402 473,409\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 767 370 L 767 390\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 473 390 L 767 390\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <path d=\"M 473 390 L 473 402\" fill=\"none\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <polygon fill=\"rgb(0,0,0)\" points=\"473,409 469,402 477,402 473,409\" stroke=\"rgb(0,0,0)\"/>\n",
+       "  <rect fill=\"none\" height=\"535\" stroke=\"rgb(243,152,0)\" stroke-dasharray=\"0 196605\" stroke-width=\"3\" width=\"834\" x=\"56\" y=\"30\"/>\n",
+       "  <rect fill=\"none\" height=\"165\" stroke=\"rgb(243,152,0)\" stroke-dasharray=\"0 196605\" stroke-width=\"3\" width=\"540\" x=\"56\" y=\"30\"/>\n",
+       "  <rect fill=\"none\" height=\"350\" stroke=\"rgb(243,152,0)\" stroke-dasharray=\"0 196605\" stroke-width=\"3\" width=\"834\" x=\"56\" y=\"215\"/>\n",
+       "</svg>"
+      ],
+      "text/plain": [
+       "<IPython.core.display.SVG object>"
+      ]
+     },
+     "execution_count": 2,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
    "source": [
     "from IPython.display import SVG\n",
-    "%cd ~/\n",
-    "%run /home/jovyan/WORKFLOW/scripts/nb_utils.py\n",
-    "SVG(filename=generate_svg_diag(diag='WORKFLOW/images/notebooks.diag'))"
+    "import os\n",
+    "\n",
+    "nb_utils_path   = os.path.join(os.environ['HOME'], 'WORKFLOW/util/scripts/nb_utils.py')\n",
+    "basic_path      = os.path.join(os.environ['HOME'], 'WORKFLOW/images')\n",
+    "basic_path_svg  = os.path.join(basic_path, 'notebooks.svg')\n",
+    "basic_path_diag = os.path.join(basic_path, 'notebooks.diag')\n",
+    "os.chdir(os.environ['HOME'])\n",
+    "!python3 $nb_utils_path $basic_path_diag\n",
+    "\n",
+    "SVG(filename=basic_path_svg)"
    ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": []
   }
  ],
  "metadata": {
@@ -120,7 +247,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.7.10"
+   "version": "3.9.7"
   }
  },
  "nbformat": 4,