From 656f10e80439ed94610058b595bcbc73dd91b10f Mon Sep 17 00:00:00 2001 From: Henry Luetcke <hluetcke@ethz.ch> Date: Thu, 8 Jul 2021 12:05:14 +0200 Subject: [PATCH] clear notebook output --- pybis_example.ipynb | 332 ++++---------------------------------------- 1 file changed, 25 insertions(+), 307 deletions(-) diff --git a/pybis_example.ipynb b/pybis_example.ipynb index 3989c63ebae..40fc3dd32df 100644 --- a/pybis_example.ipynb +++ b/pybis_example.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -19,7 +19,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -28,17 +28,9 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdin", - "output_type": "stream", - "text": [ - " 路路路路路路路路路路路路路\n" - ] - } - ], + "outputs": [], "source": [ "username = 'hluetcke'\n", "pw = getpass.getpass()" @@ -46,7 +38,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -56,96 +48,27 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'hluetcke-210707114707411xDBE993550910BD60EE612EF16B373511'" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "o.token" ] }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "o.is_session_active()" ] }, { "cell_type": "code", - "execution_count": 18, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "<div>\n", - "<style scoped>\n", - " .dataframe tbody tr th:only-of-type {\n", - " vertical-align: middle;\n", - " }\n", - "\n", - " .dataframe tbody tr th {\n", - " vertical-align: top;\n", - " }\n", - "\n", - " .dataframe thead th {\n", - " text-align: right;\n", - " }\n", - "</style>\n", - "<table border=\"1\" class=\"dataframe\">\n", - " <thead>\n", - " <tr style=\"text-align: right;\">\n", - " <th></th>\n", - " <th>code</th>\n", - " <th>downloadUrl</th>\n", - " <th>remoteUrl</th>\n", - " </tr>\n", - " </thead>\n", - " <tbody>\n", - " <tr>\n", - " <th>0</th>\n", - " <td>DSS1</td>\n", - " <td>https://127.0.0.1:443</td>\n", - " <td>http://127.0.0.1:8081</td>\n", - " </tr>\n", - " </tbody>\n", - "</table>\n", - "</div>" - ], - "text/plain": [ - " code downloadUrl remoteUrl\n", - "0 DSS1 https://127.0.0.1:443 http://127.0.0.1:8081" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "o.get_datastores()" ] @@ -351,7 +274,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -360,80 +283,25 @@ }, { "cell_type": "code", - "execution_count": 20, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "experiment successfully created.\n" - ] - }, - { - "data": { - "text/html": [ - "\n", - " <table border=\"1\" class=\"dataframe\">\n", - " <thead>\n", - " <tr style=\"text-align: right;\">\n", - " <th>attribute</th>\n", - " <th>value</th>\n", - " </tr>\n", - " </thead>\n", - " <tbody>\n", - " <tr> <td>code</td> <td>EXP123456789</td> </tr><tr> <td>permId</td> <td>20210707114742976-102</td> </tr><tr> <td>identifier</td> <td>/HLUETCKE/PLAYGROUND/EXP123456789</td> </tr><tr> <td>type</td> <td>UNKNOWN</td> </tr><tr> <td>project</td> <td>/HLUETCKE/PLAYGROUND</td> </tr><tr> <td>tags</td> <td>[]</td> </tr><tr> <td>registrator</td> <td>hluetcke</td> </tr><tr> <td>registrationDate</td> <td>2021-07-07 13:47:43</td> </tr><tr> <td>modifier</td> <td>hluetcke</td> </tr><tr> <td>modificationDate</td> <td>2021-07-07 13:47:43</td> </tr><tr> <td>frozen</td> <td>False</td> </tr><tr> <td>frozenForDataSets</td> <td>False</td> </tr><tr> <td>frozenForSamples</td> <td>False</td> </tr><tr><td>attachments</td><td></td></tr>\n", - " </tbody>\n", - " </table>\n", - " " - ], - "text/plain": [ - "attribute value\n", - "----------------- ---------------------------------\n", - "code EXP123456789\n", - "permId 20210707114742976-102\n", - "identifier /HLUETCKE/PLAYGROUND/EXP123456789\n", - "type UNKNOWN\n", - "project /HLUETCKE/PLAYGROUND\n", - "tags []\n", - "registrator hluetcke\n", - "registrationDate 2021-07-07 13:47:43\n", - "modifier hluetcke\n", - "modificationDate 2021-07-07 13:47:43\n", - "frozen False\n", - "frozenForDataSets False\n", - "frozenForSamples False" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "experiment.save()" ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "experiment 20210707114742976-102 successfully deleted.\n" - ] - } - ], + "outputs": [], "source": [ "experiment.delete('bla')" ] }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -442,182 +310,32 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "project successfully created.\n" - ] - }, - { - "data": { - "text/html": [ - "\n", - " <table border=\"1\" class=\"dataframe\">\n", - " <thead>\n", - " <tr style=\"text-align: right;\">\n", - " <th>attribute</th>\n", - " <th>value</th>\n", - " </tr>\n", - " </thead>\n", - " <tbody>\n", - " <tr> <td>code</td> <td>TEST_PROJECT</td> </tr><tr> <td>description</td> <td>boring project</td> </tr><tr> <td>permId</td> <td>20210707120832998-103</td> </tr><tr> <td>identifier</td> <td>/HLUETCKE/TEST_PROJECT</td> </tr><tr> <td>space</td> <td>HLUETCKE</td> </tr><tr> <td>leader</td> <td></td> </tr><tr> <td>registrator</td> <td>hluetcke</td> </tr><tr> <td>registrationDate</td> <td>2021-07-07 14:08:33</td> </tr><tr> <td>modifier</td> <td>12</td> </tr><tr> <td>modificationDate</td> <td>2021-07-07 14:08:33</td> </tr><tr> <td>frozen</td> <td>False</td> </tr><tr> <td>frozenForExperiments</td> <td>False</td> </tr><tr> <td>frozenForSamples</td> <td>False</td> </tr><tr><td>attachments</td><td></td></tr>\n", - " </tbody>\n", - " </table>\n", - " " - ], - "text/plain": [ - "attribute value\n", - "-------------------- ----------------------\n", - "code TEST_PROJECT\n", - "description boring project\n", - "permId 20210707120832998-103\n", - "identifier /HLUETCKE/TEST_PROJECT\n", - "space HLUETCKE\n", - "leader\n", - "registrator hluetcke\n", - "registrationDate 2021-07-07 14:08:33\n", - "modifier 12\n", - "modificationDate 2021-07-07 14:08:33\n", - "frozen False\n", - "frozenForExperiments False\n", - "frozenForSamples False" - ] - }, - "execution_count": 23, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "project.save()" ] }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "experiment = o.new_experiment(type='UNKNOWN', code='EXP333', project='/HLUETCKE/TEST_PROJECT')" ] }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "experiment successfully created.\n" - ] - }, - { - "data": { - "text/html": [ - "\n", - " <table border=\"1\" class=\"dataframe\">\n", - " <thead>\n", - " <tr style=\"text-align: right;\">\n", - " <th>attribute</th>\n", - " <th>value</th>\n", - " </tr>\n", - " </thead>\n", - " <tbody>\n", - " <tr> <td>code</td> <td>EXP333</td> </tr><tr> <td>permId</td> <td>20210707121043770-104</td> </tr><tr> <td>identifier</td> <td>/HLUETCKE/TEST_PROJECT/EXP333</td> </tr><tr> <td>type</td> <td>UNKNOWN</td> </tr><tr> <td>project</td> <td>/HLUETCKE/TEST_PROJECT</td> </tr><tr> <td>tags</td> <td>[]</td> </tr><tr> <td>registrator</td> <td>hluetcke</td> </tr><tr> <td>registrationDate</td> <td>2021-07-07 14:10:44</td> </tr><tr> <td>modifier</td> <td>hluetcke</td> </tr><tr> <td>modificationDate</td> <td>2021-07-07 14:10:44</td> </tr><tr> <td>frozen</td> <td>False</td> </tr><tr> <td>frozenForDataSets</td> <td>False</td> </tr><tr> <td>frozenForSamples</td> <td>False</td> </tr><tr><td>attachments</td><td></td></tr>\n", - " </tbody>\n", - " </table>\n", - " " - ], - "text/plain": [ - "attribute value\n", - "----------------- -----------------------------\n", - "code EXP333\n", - "permId 20210707121043770-104\n", - "identifier /HLUETCKE/TEST_PROJECT/EXP333\n", - "type UNKNOWN\n", - "project /HLUETCKE/TEST_PROJECT\n", - "tags []\n", - "registrator hluetcke\n", - "registrationDate 2021-07-07 14:10:44\n", - "modifier hluetcke\n", - "modificationDate 2021-07-07 14:10:44\n", - "frozen False\n", - "frozenForDataSets False\n", - "frozenForSamples False" - ] - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "experiment.save()" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "experiment 20210707121043770-104 successfully deleted.\n" - ] - } - ], - "source": [ - "experiment.delete('bla')" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": {}, - "outputs": [ - { - "ename": "ValueError", - "evalue": "Project 'TEST_PROJECT' can not be deleted because the following experiments are in the trash can: [EXP333] (Context: [])", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m<ipython-input-27-9412c08c33df>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mproject\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdelete\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'bla'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m~/miniconda3/lib/python3.9/site-packages/pybis/openbis_object.py\u001b[0m in \u001b[0;36mdelete\u001b[0;34m(self, reason)\u001b[0m\n\u001b[1;32m 149\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 150\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 151\u001b[0;31m self.openbis.delete_openbis_entity(\n\u001b[0m\u001b[1;32m 152\u001b[0m \u001b[0mentity\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_entity\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 153\u001b[0m \u001b[0mobjectId\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'permId'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/miniconda3/lib/python3.9/site-packages/pybis/pybis.py\u001b[0m in \u001b[0;36mdelete_openbis_entity\u001b[0;34m(self, entity, objectId, reason)\u001b[0m\n\u001b[1;32m 2559\u001b[0m ]\n\u001b[1;32m 2560\u001b[0m }\n\u001b[0;32m-> 2561\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_post_request\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mas_v3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2562\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2563\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/miniconda3/lib/python3.9/site-packages/pybis/pybis.py\u001b[0m in \u001b[0;36m_post_request\u001b[0;34m(self, resource, request)\u001b[0m\n\u001b[1;32m 1064\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1065\u001b[0m \"\"\"\n\u001b[0;32m-> 1066\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_post_request_full_url\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0murljoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mresource\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1067\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1068\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_post_request_full_url\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfull_url\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/miniconda3/lib/python3.9/site-packages/pybis/pybis.py\u001b[0m in \u001b[0;36m_post_request_full_url\u001b[0;34m(self, full_url, request)\u001b[0m\n\u001b[1;32m 1090\u001b[0m \u001b[0;31m#print(full_url)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1091\u001b[0m \u001b[0;31m#print(json.dumps(request))\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1092\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresp\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'error'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'message'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1093\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0;34m'result'\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mresp\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1094\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mresp\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'result'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mValueError\u001b[0m: Project 'TEST_PROJECT' can not be deleted because the following experiments are in the trash can: [EXP333] (Context: [])" - ] - } - ], - "source": [ - "project.delete('bla')" - ] - }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "source": [ + "experiment.save()" + ] }, { "cell_type": "code", -- GitLab