This is an example of an OGC-compliant application package for a simple Jupyter Notebook that echos and writes a string to an output file. The notebook is parameterized using papermill.
-
hello-world.ipynb
- Notebook/algorithm. All this notebook does is echo and write a string to an output file.
-
inputs.json
- Contains the input string to inject into the papermilled
hello-world.ipynb
notebook.
- Contains the input string to inject into the papermilled
-
hello-world.cwl
- Notebook CWL workflow.
-
main-workflow.cwl
- Staged CWL workflow. This workflow is split into three stages:
stage_in
,process
, andstage_out
. Thestage_in
step is meant to execute a workflow that prepares the environment before running the process i.e. localizing input datasets. Theprocess
step executes the notebook algorithm workflow. Thestage_out
step could be used to execute a workflow that publishes generated datasets, or performs cleanup activities.
- Staged CWL workflow. This workflow is split into three stages:
-
hello-world.json
- Application descriptor. This file defines the process parameters and how to execute the process, including which workflow to execute. The WPS will ingest this file to deploy a process.
For more information regarding OGC, see here.
Install the CWL command line tool.
git clone https://github.com/marjo-luc/hello-world.git
cd hello-world
Execute subworkflow using the CWL runner
cwl-runner --no-read-only hello-world.cwl --input_1 "Hi!"
Execute main workflow using the CWL runner
cwl-runner --no-read-only main-workflow.cwl --input_1 "Hi!"
Execute notebook in batch mode using Docker
docker run marjoluc/hello-world:stable ./run.sh hello-world.ipynb output.ipynb -Sinput_1 "Hello!"
Execute notebook in batch mode without using Docker
conda env create --file binder/environment.yml ./run.sh hello-world.ipynb output.ipynb -Sinput_1 "Hello!"