|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": null, |
| 6 | + "id": "e4b2f485-cb8b-4e4b-b21c-c381760fc914", |
| 7 | + "metadata": {}, |
| 8 | + "outputs": [], |
| 9 | + "source": [ |
| 10 | + "# for developement\n", |
| 11 | + "%load_ext autoreload\n", |
| 12 | + "%autoreload 2" |
| 13 | + ] |
| 14 | + }, |
| 15 | + { |
| 16 | + "cell_type": "markdown", |
| 17 | + "id": "096fc6eb", |
| 18 | + "metadata": {}, |
| 19 | + "source": [ |
| 20 | + "## Use VIP with a Girder server\n", |
| 21 | + "Before reading this tutorial we recommand you to see **demo-vipsession** to understand some basis. " |
| 22 | + ] |
| 23 | + }, |
| 24 | + { |
| 25 | + "cell_type": "markdown", |
| 26 | + "id": "eec57a9a", |
| 27 | + "metadata": {}, |
| 28 | + "source": [ |
| 29 | + "### Connection with VIP & Girder" |
| 30 | + ] |
| 31 | + }, |
| 32 | + { |
| 33 | + "cell_type": "code", |
| 34 | + "execution_count": null, |
| 35 | + "id": "f2b9532d", |
| 36 | + "metadata": {}, |
| 37 | + "outputs": [], |
| 38 | + "source": [ |
| 39 | + "# Import the class\n", |
| 40 | + "from vip_client import VipGirder\n", |
| 41 | + "\n", |
| 42 | + "VipGirder.init(\n", |
| 43 | + " vip_key=\"VIP_API_KEY\",\n", |
| 44 | + " girder_key=\"GIRDER_API_KEY\")" |
| 45 | + ] |
| 46 | + }, |
| 47 | + { |
| 48 | + "cell_type": "markdown", |
| 49 | + "id": "8d4a4093", |
| 50 | + "metadata": {}, |
| 51 | + "source": [ |
| 52 | + "### Configuration variables & pipeline info" |
| 53 | + ] |
| 54 | + }, |
| 55 | + { |
| 56 | + "cell_type": "code", |
| 57 | + "execution_count": null, |
| 58 | + "id": "f72d24fb-f9f4-45b2-b7bc-0533216932ea", |
| 59 | + "metadata": {}, |
| 60 | + "outputs": [], |
| 61 | + "source": [ |
| 62 | + "# General configuration\n", |
| 63 | + "pipeline_id = \"CQUEST/0.6\"\n", |
| 64 | + "session_name = \"test_notebook_girder\"\n", |
| 65 | + "\n", |
| 66 | + "input_settings = {\n", |
| 67 | + " \"zipped_folder\": \"/collection/ReproVIPSpectro/data/quest/basis.zip\",\n", |
| 68 | + " \"data_file\": \"/collection/ReproVIPSpectro/data/quest/signals\",\n", |
| 69 | + " \"parameter_file\": \"/collection/ReproVIPSpectro/data/quest/parameters/quest_param_117T_B.txt\",\n", |
| 70 | + "}\n", |
| 71 | + "\n", |
| 72 | + "# N.B.: Here \"data_file\" leads to a folder, the other arguments lead to single files." |
| 73 | + ] |
| 74 | + }, |
| 75 | + { |
| 76 | + "cell_type": "markdown", |
| 77 | + "id": "d06461ab", |
| 78 | + "metadata": {}, |
| 79 | + "source": [ |
| 80 | + "In `input_settings`, the input files are pointed by Girder paths, usually in format: \"/collection/[collection_name]/[path_to_folder]\". \n", |
| 81 | + "- if the path leads to a file, the same file be passed to VIP;\n", |
| 82 | + "- If the path leads to a Girder item, all files in this item will be passed to VIP;\n", |
| 83 | + "- If the path leads to a Girder folder, all files in this folder will be passed to VIP." |
| 84 | + ] |
| 85 | + }, |
| 86 | + { |
| 87 | + "cell_type": "code", |
| 88 | + "execution_count": null, |
| 89 | + "id": "8bc5ad57", |
| 90 | + "metadata": {}, |
| 91 | + "outputs": [], |
| 92 | + "source": [ |
| 93 | + "VipGirder.show_pipeline(pipeline_id)" |
| 94 | + ] |
| 95 | + }, |
| 96 | + { |
| 97 | + "cell_type": "markdown", |
| 98 | + "id": "a6df1cdd", |
| 99 | + "metadata": {}, |
| 100 | + "source": [ |
| 101 | + "### Choose output location" |
| 102 | + ] |
| 103 | + }, |
| 104 | + { |
| 105 | + "cell_type": "markdown", |
| 106 | + "id": "25704920", |
| 107 | + "metadata": {}, |
| 108 | + "source": [ |
| 109 | + "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!" |
| 110 | + ] |
| 111 | + }, |
| 112 | + { |
| 113 | + "cell_type": "markdown", |
| 114 | + "id": "97d7cf93-2ab0-4d07-81b2-654b38480f9a", |
| 115 | + "metadata": {}, |
| 116 | + "source": [ |
| 117 | + "##### Output on **girder** (default)" |
| 118 | + ] |
| 119 | + }, |
| 120 | + { |
| 121 | + "cell_type": "code", |
| 122 | + "execution_count": null, |
| 123 | + "id": "cdaa53b9-eaec-44d7-a342-7b41191fcb4a", |
| 124 | + "metadata": {}, |
| 125 | + "outputs": [], |
| 126 | + "source": [ |
| 127 | + "output_dir=\"/collection/ReproVIPSpectro/test/vip_outputs\"\n", |
| 128 | + "\n", |
| 129 | + "session = VipGirder(\n", |
| 130 | + " session_name=session_name, \n", |
| 131 | + " pipeline_id=pipeline_id, \n", |
| 132 | + " input_settings=input_settings, \n", |
| 133 | + " output_dir=output_dir)" |
| 134 | + ] |
| 135 | + }, |
| 136 | + { |
| 137 | + "cell_type": "markdown", |
| 138 | + "id": "1aec7d5d-05e1-4baf-af30-2e9b42e791f1", |
| 139 | + "metadata": {}, |
| 140 | + "source": [ |
| 141 | + "##### Output on **VIP**" |
| 142 | + ] |
| 143 | + }, |
| 144 | + { |
| 145 | + "cell_type": "code", |
| 146 | + "execution_count": null, |
| 147 | + "id": "25da2f62-e044-4ffd-855f-74881ad5d770", |
| 148 | + "metadata": {}, |
| 149 | + "outputs": [], |
| 150 | + "source": [ |
| 151 | + "session = VipGirder(\n", |
| 152 | + " session_name=session_name, \n", |
| 153 | + " pipeline_id=pipeline_id, \n", |
| 154 | + " input_settings=input_settings, \n", |
| 155 | + " output_location=\"vip\")" |
| 156 | + ] |
| 157 | + }, |
| 158 | + { |
| 159 | + "cell_type": "markdown", |
| 160 | + "id": "7c726378-93b0-443d-9531-89b42735142d", |
| 161 | + "metadata": {}, |
| 162 | + "source": [ |
| 163 | + "##### Output on **local computer**" |
| 164 | + ] |
| 165 | + }, |
| 166 | + { |
| 167 | + "cell_type": "code", |
| 168 | + "execution_count": null, |
| 169 | + "id": "bff17ffe-bebc-419d-b68d-ed3b0d2f4cf7", |
| 170 | + "metadata": {}, |
| 171 | + "outputs": [], |
| 172 | + "source": [ |
| 173 | + "session = VipGirder(\n", |
| 174 | + " session_name=session_name, \n", |
| 175 | + " pipeline_id=pipeline_id, \n", |
| 176 | + " input_settings=input_settings, \n", |
| 177 | + " output_location=\"local\")" |
| 178 | + ] |
| 179 | + }, |
| 180 | + { |
| 181 | + "cell_type": "markdown", |
| 182 | + "id": "2339ec14", |
| 183 | + "metadata": {}, |
| 184 | + "source": [ |
| 185 | + "### Run & Result" |
| 186 | + ] |
| 187 | + }, |
| 188 | + { |
| 189 | + "cell_type": "markdown", |
| 190 | + "id": "4286c3df", |
| 191 | + "metadata": {}, |
| 192 | + "source": [ |
| 193 | + "Then, you can run the pipeline as usual!" |
| 194 | + ] |
| 195 | + }, |
| 196 | + { |
| 197 | + "cell_type": "markdown", |
| 198 | + "id": "ef1ec6d7", |
| 199 | + "metadata": {}, |
| 200 | + "source": [ |
| 201 | + "##### Workflow running" |
| 202 | + ] |
| 203 | + }, |
| 204 | + { |
| 205 | + "cell_type": "code", |
| 206 | + "execution_count": null, |
| 207 | + "id": "d47ee6da-1178-4646-b9f6-a71711dcac01", |
| 208 | + "metadata": {}, |
| 209 | + "outputs": [], |
| 210 | + "source": [ |
| 211 | + "session.launch_pipeline()\n", |
| 212 | + "session.monitor_workflows()" |
| 213 | + ] |
| 214 | + }, |
| 215 | + { |
| 216 | + "cell_type": "markdown", |
| 217 | + "id": "73066fe4", |
| 218 | + "metadata": {}, |
| 219 | + "source": [ |
| 220 | + "##### Downloading & Cleaning" |
| 221 | + ] |
| 222 | + }, |
| 223 | + { |
| 224 | + "cell_type": "code", |
| 225 | + "execution_count": null, |
| 226 | + "id": "81f8dc9e-22ab-4603-ae3b-28d83f0a2615", |
| 227 | + "metadata": {}, |
| 228 | + "outputs": [], |
| 229 | + "source": [ |
| 230 | + "session.download_outputs()\n", |
| 231 | + "session.finish()" |
| 232 | + ] |
| 233 | + } |
| 234 | + ], |
| 235 | + "metadata": { |
| 236 | + "kernelspec": { |
| 237 | + "display_name": "Python 3 (ipykernel)", |
| 238 | + "language": "python", |
| 239 | + "name": "python3" |
| 240 | + }, |
| 241 | + "language_info": { |
| 242 | + "codemirror_mode": { |
| 243 | + "name": "ipython", |
| 244 | + "version": 3 |
| 245 | + }, |
| 246 | + "file_extension": ".py", |
| 247 | + "mimetype": "text/x-python", |
| 248 | + "name": "python", |
| 249 | + "nbconvert_exporter": "python", |
| 250 | + "pygments_lexer": "ipython3", |
| 251 | + "version": "3.13.3" |
| 252 | + } |
| 253 | + }, |
| 254 | + "nbformat": 4, |
| 255 | + "nbformat_minor": 5 |
| 256 | +} |
0 commit comments