Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
256 changes: 256 additions & 0 deletions examples/tutorials/demo-vipgirder.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "e4b2f485-cb8b-4e4b-b21c-c381760fc914",
"metadata": {},
"outputs": [],
"source": [
"# for developement\n",
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "markdown",
"id": "096fc6eb",
"metadata": {},
"source": [
"## Use VIP with a Girder server\n",
"Before reading this tutorial we recommand you to see **demo-vipsession** to understand some basis. "
]
},
{
"cell_type": "markdown",
"id": "eec57a9a",
"metadata": {},
"source": [
"### Connection with VIP & Girder"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f2b9532d",
"metadata": {},
"outputs": [],
"source": [
"# Import the class\n",
"from vip_client import VipGirder\n",
"\n",
"VipGirder.init(\n",
" vip_key=\"VIP_API_KEY\",\n",
" girder_key=\"GIRDER_API_KEY\")"
]
},
{
"cell_type": "markdown",
"id": "8d4a4093",
"metadata": {},
"source": [
"### Configuration variables & pipeline info"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f72d24fb-f9f4-45b2-b7bc-0533216932ea",
"metadata": {},
"outputs": [],
"source": [
"# General configuration\n",
"pipeline_id = \"CQUEST/0.6\"\n",
"session_name = \"test_notebook_girder\"\n",
"\n",
"input_settings = {\n",
" \"zipped_folder\": \"/collection/ReproVIPSpectro/data/quest/basis.zip\",\n",
" \"data_file\": \"/collection/ReproVIPSpectro/data/quest/signals\",\n",
" \"parameter_file\": \"/collection/ReproVIPSpectro/data/quest/parameters/quest_param_117T_B.txt\",\n",
"}\n",
"\n",
"# N.B.: Here \"data_file\" leads to a folder, the other arguments lead to single files."
]
},
{
"cell_type": "markdown",
"id": "d06461ab",
"metadata": {},
"source": [
"In `input_settings`, the input files are pointed by Girder paths, usually in format: \"/collection/[collection_name]/[path_to_folder]\". \n",
"- if the path leads to a file, the same file be passed to VIP;\n",
"- If the path leads to a Girder item, all files in this item will be passed to VIP;\n",
"- If the path leads to a Girder folder, all files in this folder will be passed to VIP."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8bc5ad57",
"metadata": {},
"outputs": [],
"source": [
"VipGirder.show_pipeline(pipeline_id)"
]
},
{
"cell_type": "markdown",
"id": "a6df1cdd",
"metadata": {},
"source": [
"### Choose output location"
]
},
{
"cell_type": "markdown",
"id": "25704920",
"metadata": {},
"source": [
"When using girder, you can choose where the outputs will be located. For this tutorial run the cell corresponding to the location that you want!"
]
},
{
"cell_type": "markdown",
"id": "97d7cf93-2ab0-4d07-81b2-654b38480f9a",
"metadata": {},
"source": [
"##### Output on **girder** (default)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cdaa53b9-eaec-44d7-a342-7b41191fcb4a",
"metadata": {},
"outputs": [],
"source": [
"output_dir=\"/collection/ReproVIPSpectro/test/vip_outputs\"\n",
"\n",
"session = VipGirder(\n",
" session_name=session_name, \n",
" pipeline_id=pipeline_id, \n",
" input_settings=input_settings, \n",
" output_dir=output_dir)"
]
},
{
"cell_type": "markdown",
"id": "1aec7d5d-05e1-4baf-af30-2e9b42e791f1",
"metadata": {},
"source": [
"##### Output on **VIP**"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "25da2f62-e044-4ffd-855f-74881ad5d770",
"metadata": {},
"outputs": [],
"source": [
"session = VipGirder(\n",
" session_name=session_name, \n",
" pipeline_id=pipeline_id, \n",
" input_settings=input_settings, \n",
" output_location=\"vip\")"
]
},
{
"cell_type": "markdown",
"id": "7c726378-93b0-443d-9531-89b42735142d",
"metadata": {},
"source": [
"##### Output on **local computer**"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bff17ffe-bebc-419d-b68d-ed3b0d2f4cf7",
"metadata": {},
"outputs": [],
"source": [
"session = VipGirder(\n",
" session_name=session_name, \n",
" pipeline_id=pipeline_id, \n",
" input_settings=input_settings, \n",
" output_location=\"local\")"
]
},
{
"cell_type": "markdown",
"id": "2339ec14",
"metadata": {},
"source": [
"### Run & Result"
]
},
{
"cell_type": "markdown",
"id": "4286c3df",
"metadata": {},
"source": [
"Then, you can run the pipeline as usual!"
]
},
{
"cell_type": "markdown",
"id": "ef1ec6d7",
"metadata": {},
"source": [
"##### Workflow running"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d47ee6da-1178-4646-b9f6-a71711dcac01",
"metadata": {},
"outputs": [],
"source": [
"session.launch_pipeline()\n",
"session.monitor_workflows()"
]
},
{
"cell_type": "markdown",
"id": "73066fe4",
"metadata": {},
"source": [
"##### Downloading & Cleaning"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "81f8dc9e-22ab-4603-ae3b-28d83f0a2615",
"metadata": {},
"outputs": [],
"source": [
"session.download_outputs()\n",
"session.finish()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
17 changes: 6 additions & 11 deletions examples/tutorials/demo-vipsession.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"metadata": {},
"outputs": [],
"source": [
"my_session.upload_inputs(input_dir);"
"my_session.upload_inputs(input_dir)"
]
},
{
Expand Down Expand Up @@ -169,7 +169,7 @@
"outputs": [],
"source": [
"# Pipeline identifier = App/Version (/!\\ mind the case)\n",
"pipeline_id = \"CQUEST/0.2-egi\""
"pipeline_id = \"CQUEST/0.6\""
]
},
{
Expand Down Expand Up @@ -595,7 +595,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -605,7 +605,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": ".venv",
"language": "python",
"name": "python3"
},
Expand All @@ -619,14 +619,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.8"
"version": "3.11.12"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "e7370f93d1d0cde622a1f8e1c04877d8463912d04d973331ad4851f04de6915a"
}
}
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
Expand Down
Loading