### Loop Example Source: https://github.com/common-workflow-language/cwltool/blob/main/docs/loop.md An example demonstrating the cwltool:Loop requirement with a loop condition and output method. ```yaml example: run: class: ExpressionTool inputs: i1: int outputs: o1: int expression: > ${return {'o1': inputs.i1 + 1};} in: i1: i1 out: [o1] requirements: cwltool:Loop: loopWhen: $(inputs.i1 < 10) loop: i1: o1 outputMethod: last ``` -------------------------------- ### Running a partial workflow with a target step Source: https://github.com/common-workflow-language/cwltool/blob/main/README.rst Example command to run a workflow starting from a specific step. ```bash cwltool --target step3 my-wf.cwl ``` -------------------------------- ### Install the latest development version of cwltool Source: https://github.com/common-workflow-language/cwltool/blob/main/README.rst This snippet shows how to clone the cwltool repository, navigate into the directory, install it from source with dependencies, and verify the installation. ```bash git clone https://github.com/common-workflow-language/cwltool.git # clone (copy) the cwltool git repository cd cwltool # Change to source directory that git clone just downloaded pip install .[deps] # Installs ``cwltool`` from source cwlt ool --version # Check if the installation works correctly ``` -------------------------------- ### Option two specific example using SoftwareRequirement packages Source: https://github.com/common-workflow-language/cwltool/blob/main/cwltool/schemas/v1.2/concepts.md A specific example using the compact map syntax for SoftwareRequirement packages. ```yaml hints: SoftwareRequirement: packages: sourmash: specs: [ https://doi.org/10.21105/joss.00027 ] screed: version: [ "1.0" ] python: {} ``` -------------------------------- ### Install cwltool development version Source: https://github.com/common-workflow-language/cwltool/blob/main/docs/index.md Clones the cwltool repository and installs the latest development version from source. ```bash git clone https://github.com/common-workflow-language/cwltool.git cd cwltool pip install .[deps] cwltool --version ``` -------------------------------- ### Option two specific example using Workflow inputs Source: https://github.com/common-workflow-language/cwltool/blob/main/cwltool/schemas/v1.2/concepts.md A specific example using the compact map syntax for Workflow inputs. ```yaml inputs: workflow_input01: type: string workflow_input02: type: File format: http://edamontology.org/format_2572 ``` -------------------------------- ### Option two generic example Source: https://github.com/common-workflow-language/cwltool/blob/main/cwltool/schemas/v1.2/concepts.md A generic example of the compact map syntax where a key field becomes the map key. ```yaml some_cwl_field: a_complex_type1: # this was the "key_field" from above field2: foo field3: bar a_complex_type2: field2: foo2 field3: bar2 a_complex_type3: {} # we accept the defualt values for "field2" and "field3" ``` -------------------------------- ### Workflow Execution Provenance Source: https://github.com/common-workflow-language/cwltool/blob/main/docs/CWLProv.md Example of PROV-JSON representation for starting a workflow run. ```default activity(id:67f38794-d24a-435f-bd4a-0242a56a581b, 2018-04-16T18:27:09.428165, -, [prov:type='wfprov:WorkflowRun', prov:label="Run of workflow/packed.cwl#main"]) wasStartedBy(id:67f38794-d24a-435f-bd4a-0242a56a581b, -, id:7c9d9e88-666b-4977-85f4-c02da08a942d, 2018-04-16T18:27:09.428285) ``` -------------------------------- ### Include Example: include.txt Source: https://github.com/common-workflow-language/cwltool/blob/main/cwltool/schemas/v1.2/salad/schema_salad/metaschema/import_include.md A text file to be included. ```text hello world ``` -------------------------------- ### Running basic tests Source: https://github.com/common-workflow-language/cwltool/blob/main/docs/index.md Command to run basic tests after installing cwltool. ```bash pip install -rtest-requirements.txt pytest ## N.B. This requires node.js or docker to be available ``` -------------------------------- ### Install cwltool using pip (when installing alongside other CWL implementations) Source: https://github.com/common-workflow-language/cwltool/blob/main/README.rst This command installs only the cwltool package using pip, recommended when installing alongside other CWL implementations. ```bash pip install cwltool ``` -------------------------------- ### Basic SoftwareRequirement Example Source: https://github.com/common-workflow-language/cwltool/blob/main/docs/index.md Command to run cwltool with a basic dependency resolver configuration. ```bash cwltool --beta-dependency-resolvers-configuration tests/test_deps_env_resolvers_conf.yml \ tests/random_lines.cwl \ tests/random_lines_job.json ``` -------------------------------- ### Running Tests with Tox Source: https://github.com/common-workflow-language/cwltool/blob/main/CONTRIBUTING.md Example of running specific tests (unit and type tests for Python 3.7) using tox. ```bash tox -e py37-mypy ``` -------------------------------- ### Installing Dependencies and Development Tools Source: https://github.com/common-workflow-language/cwltool/blob/main/CONTRIBUTING.md Command to install CWLTool in development mode with necessary tools. ```bash make install-dep dev ``` -------------------------------- ### Creating and Activating a Virtual Environment Source: https://github.com/common-workflow-language/cwltool/blob/main/CONTRIBUTING.md Steps to create a Python virtual environment for development. ```bash python3 -m venv cwltool source venv/bin/activate ``` -------------------------------- ### Install CWL test parser Source: https://github.com/common-workflow-language/cwltool/blob/main/cwltool/schemas/v1.2/index.md Installs the CWL test parser using pip. ```bash pip install cwltest ``` -------------------------------- ### Loop-independent iterations with 'all' output method Source: https://github.com/common-workflow-language/cwltool/blob/main/docs/loop.md An example demonstrating loop-independent iterations where each iteration can be processed concurrently. ```yaml example: run: inner.cwl in: i1: i1 out: [o1] requirements: cwltool:Loop: loopWhen: $(inputs.i1 < 10) loop: i1: valueFrom: $(inputs.i1 + 1) outputMethod: all ``` -------------------------------- ### Install CWL reference runner Source: https://github.com/common-workflow-language/cwltool/blob/main/cwltool/schemas/v1.2/index.md Installs the CWL reference runner using pip. ```bash pip install cwlref-runner ``` -------------------------------- ### Option three generic example Source: https://github.com/common-workflow-language/cwltool/blob/main/cwltool/schemas/v1.2/concepts.md A generic example of a more compact option where only key fields are specified. ```yaml some_cwl_field: a_complex_type1: foo # we accept the default value for field3 a_complex_type2: foo2 # we accept the default value for field3 a_complex_type3: {} # we accept the default values for "field2" and "field3" ``` -------------------------------- ### Option one generic example Source: https://github.com/common-workflow-language/cwltool/blob/main/cwltool/schemas/v1.2/concepts.md A generic example of the verbose array format for map-like structures. ```yaml some_cwl_field: - key_field: a_complex_type1 field2: foo field3: bar - key_field: a_complex_type2 field2: foo2 field3: bar2 - key_field: a_complex_type3 ``` -------------------------------- ### Printing Workflow Targets Source: https://github.com/common-workflow-language/cwltool/blob/main/docs/index.md Examples of using --print-targets and --print-subgraph to inspect workflow targets. ```bash cwltool --print-targets my-wf.cwl ``` ```bash cwltool --target step3 --print-subgraph my-wf.cwl > my-wf-starting-from-step3.cwl ```