|
138 | 138 | " print(\"Token received.\")"
|
139 | 139 | ]
|
140 | 140 | },
|
| 141 | + { |
| 142 | + "cell_type": "markdown", |
| 143 | + "id": "98017416-3d3c-4225-843f-8f2fa35be36b", |
| 144 | + "metadata": {}, |
| 145 | + "source": [ |
| 146 | + "## 1. Query Dockstore" |
| 147 | + ] |
| 148 | + }, |
| 149 | + { |
| 150 | + "cell_type": "code", |
| 151 | + "execution_count": null, |
| 152 | + "id": "ce34b502-6b55-42d1-bce8-f0a382ea392f", |
| 153 | + "metadata": {}, |
| 154 | + "outputs": [], |
| 155 | + "source": [ |
| 156 | + "r = requests.get(\"http://uads-test-dockstore-deploy-lb-1762603872.us-west-2.elb.amazonaws.com:9998/api/workflows/published\")\n", |
| 157 | + "r.raise_for_status()\n", |
| 158 | + "json = r.json()\n", |
| 159 | + "\n", |
| 160 | + "print(\"\\n\\nList of Application Packages available in Dockstore:\")\n", |
| 161 | + "JSON(json)" |
| 162 | + ] |
| 163 | + }, |
| 164 | + { |
| 165 | + "cell_type": "markdown", |
| 166 | + "id": "59a80d9c-6a9a-4612-bda5-39eaf64bf8e9", |
| 167 | + "metadata": {}, |
| 168 | + "source": [ |
| 169 | + "## 2. Select an application from Dockstore\n", |
| 170 | + "\n", |
| 171 | + "In the previous step we queried Dockstore and retrieved a list of applications. From this list of applications, select one and set the `workflow_id` and `workflow_version_id` in the cell below.\n", |
| 172 | + "\n", |
| 173 | + "`workflow_id` is a field labeled `id` from Dockstore.\n", |
| 174 | + "`workflow_version_id` is a field labeled `id` in the `workflowVersions` object.\n", |
| 175 | + "\n", |
| 176 | + "The ID values set below reference an example Sounder SIPS L1B application registered in Unity's Dockstore Test environment." |
| 177 | + ] |
| 178 | + }, |
| 179 | + { |
| 180 | + "cell_type": "code", |
| 181 | + "execution_count": null, |
| 182 | + "id": "b0c6b491-8130-4f8c-a8a3-5bd19c90ba24", |
| 183 | + "metadata": {}, |
| 184 | + "outputs": [], |
| 185 | + "source": [ |
| 186 | + "workflow_id = 16\n", |
| 187 | + "workflow_version_id = 31" |
| 188 | + ] |
| 189 | + }, |
| 190 | + { |
| 191 | + "cell_type": "markdown", |
| 192 | + "id": "9e36a5fb-25ab-40ad-a9cb-ed2c06597cea", |
| 193 | + "metadata": {}, |
| 194 | + "source": [ |
| 195 | + "## 3. Fetch the application's metadata\n", |
| 196 | + "\n", |
| 197 | + "The code below will download a ZIP file containing the CWL files associated with the selected package. The name of the zip will the name of the application (aka workflow). The information in the ZIP file will be used to create a JSON payload needed to deploy the application to Unity's Science Processing Service.\n", |
| 198 | + "\n", |
| 199 | + "***Note, this ZIP file contains a file named `.dockstore.yml` which when unpackad will not be visible in JupyterLab's Folder/File View, it will be viewable via a Terminal window.***" |
| 200 | + ] |
| 201 | + }, |
| 202 | + { |
| 203 | + "cell_type": "code", |
| 204 | + "execution_count": null, |
| 205 | + "id": "5f1c287f-939c-424d-bb12-b5145643ba38", |
| 206 | + "metadata": {}, |
| 207 | + "outputs": [], |
| 208 | + "source": [ |
| 209 | + "r_zip = requests.get(\"http://uads-test-dockstore-deploy-lb-1762603872.us-west-2.elb.amazonaws.com:9998/api/workflows/{workflowId}/zip/{workflowVersionId}\".format(workflowId=16,workflowVersionId=31))\n", |
| 210 | + "r_zip.raise_for_status()\n", |
| 211 | + "\n", |
| 212 | + "workflow_name = json[0]['workflowName']\n", |
| 213 | + "open(\"{}.zip\".format(workflow_name), 'wb').write(r_zip.content)" |
| 214 | + ] |
| 215 | + }, |
| 216 | + { |
| 217 | + "cell_type": "markdown", |
| 218 | + "id": "69d43073-3e99-4ea2-8021-9104b4003e84", |
| 219 | + "metadata": {}, |
| 220 | + "source": [ |
| 221 | + "## 4. Deploy Application\n", |
| 222 | + "\n", |
| 223 | + "Now that we have collected the information about the application from Dockstore, we can package it up and prep it for deployment to Unity's Science Processing Service.\n", |
| 224 | + "\n", |
| 225 | + "Coming soon..." |
| 226 | + ] |
| 227 | + }, |
141 | 228 | {
|
142 | 229 | "cell_type": "markdown",
|
143 | 230 | "id": "9f1cdbbc-6c38-4c2a-955a-08ac8d13e366",
|
144 | 231 | "metadata": {},
|
145 | 232 | "source": [
|
146 |
| - "## 1. List Processes\n", |
| 233 | + "## 5. List Processes\n", |
147 | 234 | "\n",
|
148 | 235 | "The Unity API defines a way of viewing all deployed application packages (a.k.a., Processes) on the system using the 'get_apps' function. After a successful deployment of an application package to the Processing endpoint, you should see a new entry for the deployed application.\n",
|
149 | 236 | "\n",
|
|
173 | 260 | "id": "00fc3f8f-8d05-4765-92cb-99bc25778a02",
|
174 | 261 | "metadata": {},
|
175 | 262 | "source": [
|
176 |
| - "## 2. Execute a job\n", |
| 263 | + "## 6. Execute a job\n", |
177 | 264 | "Before deploying Applications and working with jobs, it is assumed that a system administrator has deployed an ADES. These are often called \"venues\" or \"environments\", and some examples may be dev, test, prod, etc. To run a Job, you need a Process available as well (a deployed Application). In this case we have a demo application deployed and referenced in the setup step 0 above.\n",
|
178 | 265 | "\n",
|
179 | 266 | "With an ADES and a Process ready to accept our Job, we can submit a Job along with any input data or parameters that are needed (as defined by a template job definition for a particular Application). In this example case, none are needed so `inputs` is blank. The response will provide a Job ID that we will store in a variable called `job_id` for use later.\n",
|
|
222 | 309 | "id": "7aed28d0-ab28-445c-bbb7-9ead5f5aa160",
|
223 | 310 | "metadata": {},
|
224 | 311 | "source": [
|
225 |
| - "## 3. Get the Job status\n", |
| 312 | + "## 7. Get the Job status\n", |
226 | 313 | "The code below will demonstrate how one can check the status of the Job. The potential status responses are documented [here] _need a reference to process status_.\n",
|
227 | 314 | "\n",
|
228 | 315 | "In this example, we will look up the status of the predfined application name from the setup step 0, and the job ID that was returned previously. This function will loop/block until the process ends. You will see a printout every 5 seconds."
|
|
260 | 347 | "id": "7198115b-2142-4ac7-8581-b1664b2278e7",
|
261 | 348 | "metadata": {},
|
262 | 349 | "source": [
|
263 |
| - "## 4. Get Job results\n", |
| 350 | + "## 8. Get Job results\n", |
264 | 351 | "Now that we've monitored the status of a Job, and verified that is has completed, we can retreive information about where the generated data is located. \n",
|
265 | 352 | "\n",
|
266 | 353 | "In this example, we will use the predefined Process name, and the Job ID that was returned previously."
|
|
307 | 394 | "id": "1d9e1a16-cc62-4d0a-87a8-f1c0256c9ac3",
|
308 | 395 | "metadata": {},
|
309 | 396 | "source": [
|
310 |
| - "## 5. List the Jobs processed by a given Process\n", |
| 397 | + "## 9. List the Jobs processed by a given Process\n", |
311 | 398 | "\n",
|
312 | 399 | "What if I restarted my notebook and I have no Job ID? The API can ask the process endpoint to list the Jobs for a given Process (deployed Application).\n"
|
313 | 400 | ]
|
|
330 | 417 | "print(\"\\n\\nFull JSON output data of get_jobs_for_app\")\n",
|
331 | 418 | "JSON(jobs)"
|
332 | 419 | ]
|
333 |
| - }, |
334 |
| - { |
335 |
| - "cell_type": "code", |
336 |
| - "execution_count": null, |
337 |
| - "id": "2f68959b-883b-4aee-a0ce-4105a4cf5aca", |
338 |
| - "metadata": {}, |
339 |
| - "outputs": [], |
340 |
| - "source": [] |
341 | 420 | }
|
342 | 421 | ],
|
343 | 422 | "metadata": {
|
|
356 | 435 | "name": "python",
|
357 | 436 | "nbconvert_exporter": "python",
|
358 | 437 | "pygments_lexer": "ipython3",
|
359 |
| - "version": "3.10.5" |
| 438 | + "version": "3.9.6" |
360 | 439 | }
|
361 | 440 | },
|
362 | 441 | "nbformat": 4,
|
|
0 commit comments