Skip to content

Update notebooks with dockstore info #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 9, 2022
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.png filter=lfs diff=lfs merge=lfs -text
Binary file modified img/jl_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/jl_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/jl_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed jupyter-notebooks/.DS_Store
Binary file not shown.
127 changes: 125 additions & 2 deletions jupyter-notebooks/tutorials/1_working_with_applications.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,130 @@
"metadata": {},
"source": [
"# Working with Applications\n",
"The intent of this tutorial is to help familiarize yourself with submitting applications to the Unity Application Catalog. Adding applications to the application catalog allows you and others to generate data by submitting jobs that use an application selected from the catalog."
"The intent of this tutorial is to help familiarize yourself with submitting applications to the Unity Application Catalog. Adding applications to the application catalog allows you and others to generate data by submitting jobs that use an application selected from the catalog.\n",
"\n",
"***Note, accounts and repositories hosted on GitHub.com are currently supported. GitHub Enterprise is not supported.***"
]
},
{
"cell_type": "markdown",
"id": "7fe60b57-62c8-44a8-aa20-cf5dd7551af1",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
"## I. Create a Dockstore account"
]
},
{
"cell_type": "markdown",
"id": "ac226cbe-bcd9-4365-b4a0-a3ad55fb3a90",
"metadata": {
"tags": []
},
"source": [
"#### 1. Visit [Unity's Dockstore Test Instance](http://uads-test-dockstore-deploy-lb-1762603872.us-west-2.elb.amazonaws.com:9998/).\n",
"_For the purposes of this tutorial, we will be using Unity's test environment._\n",
"\n",
"![Dockstore Home](images/01-Dockstore-Home.png \"Dockstore Homepage\")\n",
"<br><br>\n",
"\n",
"#### 2. Click Register in the top right corner and you will be redirected to the Dockstore Registration page.\n",
"\n",
"![Dockstore Registration Page](images/02-Register.png \"Dockstore Registeration Page\")\n",
"<br><br>\n",
"\n",
"#### 3. Agree to Dockstore's Terms of Service and Privacy by enabling the checkbox and then clicking the \"Register with GitHub\" button.\n",
"\n",
"![Dockstore TOS and Privacy Policy Acknowledgement](images/03-Enable-Checkbox.png \"Acknowledge TOS and Privacy Policy\")\n",
"<br><br>\n",
"\n",
"#### 4. Authorize the JPL Dockstore Application access to your GitHub account.\n",
"\n",
"![Unity Dockstore Application Authorization](images/04-Dockstore-App-Authorization.png \"Authorize Unity Dockstore Application\")\n",
"<br><br>\n",
"\n",
"#### 5. Verify your Github Username is correct and click `Next`.\n",
"\n",
"![Verify GitHub Username](images/05-Verify-Username.png \"Verify Github Username\")\n",
"<br><br>\n",
"\n",
"#### 6. On the Link External Accounts screen, scroll to the bottom and click `Next`.\n",
"\n",
"![Link External Accounts Screen](images/06-02-Link-External-Accounts-Click-Next.png \"Click next at the bottom of the Link External Accounts Screen\")\n",
"<br><br>\n",
"\n",
"#### 7. On the Setup Dockstore CLI screen, scroll to the bottom and click `Next`.\n",
"\n",
"![Setup Dockstore CLI screen](images/07-02-Setup-CLI-Click-Next.png \"Click next at the bottom of the Setup Dockstore CLI screen.\")\n",
"<br><br>\n",
"\n",
"#### 8. When you reach the \"Next Steps\" screen, you're account is set up and ready to be configured with your GitHub Account and Application Repositories.\n",
"\n",
"![Next Steps Dockstore Registration Screen](images/08-Next-Steps.png \"Final Dockstore Setup Screen\")\n",
"<br><br>\n",
"\n",
"---"
]
},
{
"cell_type": "markdown",
"id": "1ae3c385-7190-4a5e-963f-617190d1a64c",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
"---\n",
"## II. Configure GitHub Account and Repository Access for Dockstore\n"
]
},
{
"cell_type": "markdown",
"id": "b32832c9-f7e5-4578-95b3-9bb6347e4a38",
"metadata": {
"tags": []
},
"source": [
"\n",
"#### 1. Visit [GitHub](https://www.github.com) and login to your account.\n",
"#### 2. Visit [https://github.com/apps/jpl-uads-dockstore](https://github.com/apps/jpl-uads-dockstore) and click the \"Configure\" button on the right of the page.\n",
"\n",
"![JPL Unity Dockstore GitHub Configuration](images/10-Configure-Dockstore-App.png \"Configure JPL Unity Dockstore GitHub App\")\n",
"<br><br>\n",
"\n",
"#### 3. Configure the JPL Unity Dockstore application by providing it access to either:\n",
"\n",
"##### All the repositories in your account or\n",
"##### Specific repositories by selecting those that Dockstore should have access to. When you have finished setting your repository information, click `Install`.\n",
"\n",
"![Repository Selection Screen for Dockstore](images/11-Install-Dockstore-App.png \"Install JPL Unity Dockstore Application\")\n",
"<br><br>\n",
"\n",
"#### 4. Add `.dockstore.yml` to your repository.\n",
"\n",
"Add a `.dockstore.yml` configuration file to your repository. Documentation to configure this file can be found [here](https://docs.dockstore.org/en/stable/getting-started/github-apps/github-apps.html). Once you have added this file to your repository, it will take approximiately 5 minutes for Dockstore to process it. once completed, your application will show in your Dockstore account under \"My Workflows\"."
]
},
{
"cell_type": "markdown",
"id": "721fbed7-ac51-4b31-98c1-8f3c7b5b8073",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
"---\n",
"## III. Continue development and maintenance of application"
]
},
{
"cell_type": "markdown",
"id": "2595b6d6-fe13-4ac0-aa26-6ab6b29d7644",
"metadata": {},
"source": [
"Now that your application is integrated with Dockstore, as you make changes, they will automatically be reflected in Dockstore."
]
}
],
Expand All @@ -26,7 +149,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.6"
}
},
"nbformat": 4,
Expand Down
107 changes: 93 additions & 14 deletions jupyter-notebooks/tutorials/3_working_with_jobs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,99 @@
" print(\"Token received.\")"
]
},
{
"cell_type": "markdown",
"id": "98017416-3d3c-4225-843f-8f2fa35be36b",
"metadata": {},
"source": [
"## 1. Query Dockstore"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ce34b502-6b55-42d1-bce8-f0a382ea392f",
"metadata": {},
"outputs": [],
"source": [
"r = requests.get(\"http://uads-test-dockstore-deploy-lb-1762603872.us-west-2.elb.amazonaws.com:9998/api/workflows/published\")\n",
"r.raise_for_status()\n",
"json = r.json()\n",
"\n",
"print(\"\\n\\nList of Application Packages available in Dockstore:\")\n",
"JSON(json)"
]
},
{
"cell_type": "markdown",
"id": "59a80d9c-6a9a-4612-bda5-39eaf64bf8e9",
"metadata": {},
"source": [
"## 2. Select an application from Dockstore\n",
"\n",
"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",
"\n",
"`workflow_id` is a field labeled `id` from Dockstore.\n",
"`workflow_version_id` is a field labeled `id` in the `workflowVersions` object.\n",
"\n",
"The ID values set below reference an example Sounder SIPS L1B application registered in Unity's Dockstore Test environment."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b0c6b491-8130-4f8c-a8a3-5bd19c90ba24",
"metadata": {},
"outputs": [],
"source": [
"workflow_id = 16\n",
"workflow_version_id = 31"
]
},
{
"cell_type": "markdown",
"id": "9e36a5fb-25ab-40ad-a9cb-ed2c06597cea",
"metadata": {},
"source": [
"## 3. Fetch the application's metadata\n",
"\n",
"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",
"\n",
"***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.***"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5f1c287f-939c-424d-bb12-b5145643ba38",
"metadata": {},
"outputs": [],
"source": [
"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",
"r_zip.raise_for_status()\n",
"\n",
"workflow_name = json[0]['workflowName']\n",
"open(\"{}.zip\".format(workflow_name), 'wb').write(r_zip.content)"
]
},
{
"cell_type": "markdown",
"id": "69d43073-3e99-4ea2-8021-9104b4003e84",
"metadata": {},
"source": [
"## 4. Deploy Application\n",
"\n",
"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",
"\n",
"Coming soon..."
]
},
{
"cell_type": "markdown",
"id": "9f1cdbbc-6c38-4c2a-955a-08ac8d13e366",
"metadata": {},
"source": [
"## 1. List Processes\n",
"## 5. List Processes\n",
"\n",
"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",
"\n",
Expand Down Expand Up @@ -173,7 +260,7 @@
"id": "00fc3f8f-8d05-4765-92cb-99bc25778a02",
"metadata": {},
"source": [
"## 2. Execute a job\n",
"## 6. Execute a job\n",
"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",
"\n",
"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",
Expand Down Expand Up @@ -222,7 +309,7 @@
"id": "7aed28d0-ab28-445c-bbb7-9ead5f5aa160",
"metadata": {},
"source": [
"## 3. Get the Job status\n",
"## 7. Get the Job status\n",
"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",
"\n",
"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."
Expand Down Expand Up @@ -260,7 +347,7 @@
"id": "7198115b-2142-4ac7-8581-b1664b2278e7",
"metadata": {},
"source": [
"## 4. Get Job results\n",
"## 8. Get Job results\n",
"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",
"\n",
"In this example, we will use the predefined Process name, and the Job ID that was returned previously."
Expand Down Expand Up @@ -307,7 +394,7 @@
"id": "1d9e1a16-cc62-4d0a-87a8-f1c0256c9ac3",
"metadata": {},
"source": [
"## 5. List the Jobs processed by a given Process\n",
"## 9. List the Jobs processed by a given Process\n",
"\n",
"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"
]
Expand All @@ -330,14 +417,6 @@
"print(\"\\n\\nFull JSON output data of get_jobs_for_app\")\n",
"JSON(jobs)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2f68959b-883b-4aee-a0ce-4105a4cf5aca",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -356,7 +435,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
"version": "3.9.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 3 additions & 0 deletions jupyter-notebooks/tutorials/images/01-Dockstore-Home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions jupyter-notebooks/tutorials/images/02-Register.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions jupyter-notebooks/tutorials/images/03-Enable-Checkbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions jupyter-notebooks/tutorials/images/05-Verify-Username.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions jupyter-notebooks/tutorials/images/07-01-Setup-CLI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions jupyter-notebooks/tutorials/images/08-Next-Steps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions jupyter-notebooks/tutorials/images/09-Dockstore-Home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.