Skip to content
Closed
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
136 changes: 94 additions & 42 deletions example_workflows/arithmetic/cwl.ipynb
Original file line number Diff line number Diff line change
@@ -1,97 +1,149 @@
{
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.12.8",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
}
},
"nbformat_minor": 5,
"nbformat": 4,
"cells": [
{
"id": "377fef56-484d-491c-b19e-1be6931e44eb",
"cell_type": "code",
"source": "import pickle",
"execution_count": 1,
"id": "377fef56-484d-491c-b19e-1be6931e44eb",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": 1
"source": [
"import pickle"
]
},
{
"id": "92e3921b-2bb8-4333-8cfe-4bd27f785d24",
"cell_type": "code",
"source": "from python_workflow_definition.cwl import load_workflow_json",
"execution_count": null,
"id": "92e3921b-2bb8-4333-8cfe-4bd27f785d24",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": 2
"source": [
"from python_workflow_definition.cwl import pwd_to_cwl"
]
},
{
"id": "5303c059-8ae4-4557-858e-b4bd64eac711",
"cell_type": "code",
"source": "load_workflow_json(file_name=\"workflow.json\")",
"execution_count": null,
"id": "5303c059-8ae4-4557-858e-b4bd64eac711",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": 3
"source": [
"pwd_to_cwl(file_name=\"workflow.json\")"
]
},
{
"id": "df302bd2-e9b6-4595-979c-67c46414d986",
"cell_type": "code",
"source": "! cwltool workflow.cwl workflow.yml",
"execution_count": 4,
"id": "df302bd2-e9b6-4595-979c-67c46414d986",
"metadata": {
"trusted": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "/srv/conda/envs/notebook/bin/cwltool:11: DeprecationWarning: Nesting argument groups is deprecated.\n sys.exit(run())\n\u001B[1;30mINFO\u001B[0m /srv/conda/envs/notebook/bin/cwltool 3.1.20250110105449\n\u001B[1;30mINFO\u001B[0m Resolved 'workflow.cwl' to 'file:///home/jovyan/example_workflows/arithmetic/workflow.cwl'\n\u001B[1;30mINFO\u001B[0m [workflow ] start\n\u001B[1;30mINFO\u001B[0m [workflow ] starting step get_prod_and_div_0\n\u001B[1;30mINFO\u001B[0m [step get_prod_and_div_0] start\n\u001B[1;30mINFO\u001B[0m [job get_prod_and_div_0] /tmp/hig0p5dd$ python \\\n -m \\\n python_workflow_definition.cwl \\\n --workflowfile=/tmp/0xeme5n4/stgba321752-0a06-41dd-95c0-f5890f1dfaae/workflow.py \\\n --function=workflow.get_prod_and_div \\\n --arg_y=/tmp/0xeme5n4/stg9f21530f-2f98-44e6-80b6-afa2aac5a083/y.pickle \\\n --arg_x=/tmp/0xeme5n4/stg2e35a78a-a776-48de-b82f-8075d3284a3c/x.pickle\n\u001B[1;30mINFO\u001B[0m [job get_prod_and_div_0] completed success\n\u001B[1;30mINFO\u001B[0m [step get_prod_and_div_0] completed success\n\u001B[1;30mINFO\u001B[0m [workflow ] starting step get_sum_1\n\u001B[1;30mINFO\u001B[0m [step get_sum_1] start\n\u001B[1;30mINFO\u001B[0m [job get_sum_1] /tmp/u07nctrs$ python \\\n -m \\\n python_workflow_definition.cwl \\\n --workflowfile=/tmp/sa53wz5h/stg686b1324-0030-4bfd-bdab-64fc9ee4d491/workflow.py \\\n --function=workflow.get_sum \\\n --arg_y=/tmp/sa53wz5h/stg1679a702-ac89-4c84-8cb5-7a57ae9e1834/div.pickle \\\n --arg_x=/tmp/sa53wz5h/stg6ab588fe-2723-416e-a7b8-648b1a63406e/prod.pickle\n\u001B[1;30mINFO\u001B[0m [job get_sum_1] completed success\n\u001B[1;30mINFO\u001B[0m [step get_sum_1] completed success\n\u001B[1;30mINFO\u001B[0m [workflow ] completed success\n{\n \"result_file\": {\n \"location\": \"file:///home/jovyan/example_workflows/arithmetic/result.pickle\",\n \"basename\": \"result.pickle\",\n \"class\": \"File\",\n \"checksum\": \"sha1$3dfd802cefb317cc7138af1e3a299f565c74ddec\",\n \"size\": 21,\n \"path\": \"/home/jovyan/example_workflows/arithmetic/result.pickle\"\n }\n}\u001B[1;30mINFO\u001B[0m Final process status is success\n"
"text": [
"/srv/conda/envs/notebook/bin/cwltool:11: DeprecationWarning: Nesting argument groups is deprecated.\n",
" sys.exit(run())\n",
"\u001b[1;30mINFO\u001b[0m /srv/conda/envs/notebook/bin/cwltool 3.1.20250110105449\n",
"\u001b[1;30mINFO\u001b[0m Resolved 'workflow.cwl' to 'file:///home/jovyan/example_workflows/arithmetic/workflow.cwl'\n",
"\u001b[1;30mINFO\u001b[0m [workflow ] start\n",
"\u001b[1;30mINFO\u001b[0m [workflow ] starting step get_prod_and_div_0\n",
"\u001b[1;30mINFO\u001b[0m [step get_prod_and_div_0] start\n",
"\u001b[1;30mINFO\u001b[0m [job get_prod_and_div_0] /tmp/hig0p5dd$ python \\\n",
" -m \\\n",
" python_workflow_definition.cwl \\\n",
" --workflowfile=/tmp/0xeme5n4/stgba321752-0a06-41dd-95c0-f5890f1dfaae/workflow.py \\\n",
" --function=workflow.get_prod_and_div \\\n",
" --arg_y=/tmp/0xeme5n4/stg9f21530f-2f98-44e6-80b6-afa2aac5a083/y.pickle \\\n",
" --arg_x=/tmp/0xeme5n4/stg2e35a78a-a776-48de-b82f-8075d3284a3c/x.pickle\n",
"\u001b[1;30mINFO\u001b[0m [job get_prod_and_div_0] completed success\n",
"\u001b[1;30mINFO\u001b[0m [step get_prod_and_div_0] completed success\n",
"\u001b[1;30mINFO\u001b[0m [workflow ] starting step get_sum_1\n",
"\u001b[1;30mINFO\u001b[0m [step get_sum_1] start\n",
"\u001b[1;30mINFO\u001b[0m [job get_sum_1] /tmp/u07nctrs$ python \\\n",
" -m \\\n",
" python_workflow_definition.cwl \\\n",
" --workflowfile=/tmp/sa53wz5h/stg686b1324-0030-4bfd-bdab-64fc9ee4d491/workflow.py \\\n",
" --function=workflow.get_sum \\\n",
" --arg_y=/tmp/sa53wz5h/stg1679a702-ac89-4c84-8cb5-7a57ae9e1834/div.pickle \\\n",
" --arg_x=/tmp/sa53wz5h/stg6ab588fe-2723-416e-a7b8-648b1a63406e/prod.pickle\n",
"\u001b[1;30mINFO\u001b[0m [job get_sum_1] completed success\n",
"\u001b[1;30mINFO\u001b[0m [step get_sum_1] completed success\n",
"\u001b[1;30mINFO\u001b[0m [workflow ] completed success\n",
"{\n",
" \"result_file\": {\n",
" \"location\": \"file:///home/jovyan/example_workflows/arithmetic/result.pickle\",\n",
" \"basename\": \"result.pickle\",\n",
" \"class\": \"File\",\n",
" \"checksum\": \"sha1$3dfd802cefb317cc7138af1e3a299f565c74ddec\",\n",
" \"size\": 21,\n",
" \"path\": \"/home/jovyan/example_workflows/arithmetic/result.pickle\"\n",
" }\n",
"}\u001b[1;30mINFO\u001b[0m Final process status is success\n"
]
}
],
"execution_count": 4
"source": [
"! cwltool workflow.cwl workflow.yml"
]
},
{
"id": "2942dbba-ea0a-4d20-be5c-ed9992d09ff8",
"cell_type": "code",
"source": "with open(\"result.pickle\", \"rb\") as f:\n print(pickle.load(f))",
"execution_count": 5,
"id": "2942dbba-ea0a-4d20-be5c-ed9992d09ff8",
"metadata": {
"trusted": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "2.5\n"
"text": [
"2.5\n"
]
}
],
"execution_count": 5
"source": [
"with open(\"result.pickle\", \"rb\") as f:\n",
" print(pickle.load(f))"
]
},
{
"id": "60e909ee-d0d0-4bd1-81c8-dd5274ae5834",
"cell_type": "code",
"source": "",
"execution_count": null,
"id": "60e909ee-d0d0-4bd1-81c8-dd5274ae5834",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": null
"source": []
}
],
"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.12.8"
}
]
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading
Loading