Browse Source

update: 軽微なリファクタリング

ivis-yoshida 2 years ago
parent
commit
0e2a89da82
1 changed files with 20 additions and 62 deletions
  1. 20 62
      WORKFLOW/SECTIONS/base/02_experimental_phase/launch_an_experiment.ipynb

+ 20 - 62
WORKFLOW/SECTIONS/base/02_experimental_phase/launch_an_experiment.ipynb

@@ -50,17 +50,9 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 85,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "ex100\n"
-     ]
-    }
-   ],
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
    "source": [
     "repository_title = input()"
    ]
@@ -87,21 +79,12 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "%%sh\n",
-    "cd ~/"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import os\n",
-    "\n",
-    "experiment_path = \"experiments/\" + repository_title\n",
-    "os.mkdir(experiment_path)\n",
-    "os.system(\"cp -r PACKAGE/* \" + experiment_path)"
+    "!mkdir ~/.tmp/\n",
+    "!git init ~/.tmp/$repository_title\n",
+    "!cp -r ~/WORKFLOW/PACKAGE/* ~/.tmp/$repository_title/\n",
+    "!git commit -m '1st commit'\n",
+    "!git remote add $ssh_url\n",
+    "!git push"
    ]
   },
   {
@@ -117,21 +100,7 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "%%sh\n",
-    "cd ~/"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import os\n",
-    "\n",
-    "os.system(\"datalad create --force -d . \" + experiment_path)\n",
-    "os.chdir(experiment_path)\n",
-    "os.system(\"datalad siblings add -s gin --url \" + ssh_url)"
+    "!git submodule add $ssh_url ~/experiments/repository_title"
    ]
   },
   {
@@ -143,30 +112,19 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 93,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "['ex100']\n"
-     ]
-    }
-   ],
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
    "source": [
     "import json\n",
-    "save_data = \"\"\n",
+    "\n",
     "with open('/home/jovyan/experiments/pipeline.json', 'r') as f:\n",
-    "    read_data = json.load(f)\n",
-    "    print(read_data)\n",
-    "if read_data == []:\n",
-    "    save_data = [repository_title]\n",
-    "else:\n",
-    "    read_data.append(repository_title)\n",
-    "    save_data = read_data\n",
+    "    pipeline = json.load(f)\n",
+    "\n",
+    "pipeline.append(repository_title)\n",
+    "\n",
     "with open('/home/jovyan/experiments/pipeline.json', 'w') as f:\n",
-    "    json.dump(save_data, f, indent = 4)"
+    "    json.dump(pipeline, f, indent = 4)"
    ]
   },
   {
@@ -247,7 +205,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.7.8"
+   "version": "3.8.12"
   }
  },
  "nbformat": 4,