Created
December 11, 2025 16:26
-
-
Save danlooo/56e4e04c4a27ec6649baf4e5d44d5eea to your computer and use it in GitHub Desktop.
CWL workflow with breakpoints for debugging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env cwltool | |
| cwlVersion: v1.2 | |
| class: CommandLineTool | |
| inputs: | |
| message: | |
| type: string | |
| outputs: | |
| outfile: | |
| type: File | |
| outputBinding: | |
| glob: output.txt | |
| baseCommand: [bash, run.sh] | |
| requirements: | |
| DockerRequirement: | |
| dockerImageId: hello-world | |
| dockerFile: | | |
| FROM python | |
| InitialWorkDirRequirement: | |
| listing: | |
| - entryname: inputs.json | |
| entry: $(inputs) | |
| - entryname: cwl.py | |
| entry: | | |
| #!/usr/bin/env python | |
| import os | |
| import sys | |
| import time | |
| if sys.argv[1] == "pause": | |
| # normal print will be catched by cwltool | |
| with open("state", "a") as f: | |
| f.write("PAUSED") | |
| os.system(f"echo Debug mode enabled and workflow paused.") | |
| os.system(f"echo Access container: docker exec -it {os.environ["HOSTNAME"]} bash") | |
| os.system(f"echo Unpause container: docker exec -it {os.environ["HOSTNAME"]} python cwl.py next") | |
| paused = True | |
| while paused: | |
| time.sleep(1) | |
| paused = open("state", "r").read() == "PAUSED" | |
| elif sys.argv[1] == "next": | |
| with open("state", "a") as f: | |
| f.write("RUN") | |
| - entryname: run.sh | |
| entry: | | |
| #!/usr/bin/env bash | |
| echo hi | |
| python cwl.py pause | |
| echo hello, $(inputs.message) > output.txt |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run with
cwltool hello-world-with-debug.cwl --message world. Removepython cwl.py pauseto remove the break point.