Essential Input Parameters¶
Essential Input Parameters refers to the 2.4.1. Essential Input Parameters paragraph of the 2.4. Inputs chapter of the Common Workflow Language User Guide
1. Parsing¶
In this sample we'll show the access from a remote public URL.
In [1]:
Copied!
from cwl_loader import load_cwl_from_location
from cwl2ogc import BaseCWLtypes2OGCConverter
cwl_document = load_cwl_from_location('https://raw.githubusercontent.com/eoap/cwl2ogc/refs/heads/develop/tests/artifacts/cwl-types/inp.cwl')
cwl_converter = BaseCWLtypes2OGCConverter(cwl_document)
from cwl_loader import load_cwl_from_location
from cwl2ogc import BaseCWLtypes2OGCConverter
cwl_document = load_cwl_from_location('https://raw.githubusercontent.com/eoap/cwl2ogc/refs/heads/develop/tests/artifacts/cwl-types/inp.cwl')
cwl_converter = BaseCWLtypes2OGCConverter(cwl_document)
2025-08-12 16:36:55.764 | INFO | cwl_loader:load_cwl_from_location:186 - Loading CWL document from https://raw.githubusercontent.com/eoap/cwl2ogc/refs/heads/develop/tests/artifacts/cwl-types/inp.cwl...
2025-08-12 16:36:55.890 | INFO | cwl_loader:load_cwl_from_yaml:117 - Updating the model to v1.2...
2025-08-12 16:36:55.895 | INFO | cwl_loader:load_cwl_from_yaml:128 - Raw CWL document successfully updated to v1.2! Now converting to the CWL model...
2025-08-12 16:36:55.929 | INFO | cwl_loader:load_cwl_from_yaml:136 - Raw CWL document successfully updated to v1.2! Now dereferencing the FQNs...
2025-08-12 16:36:55.930 | INFO | cwl_loader:_clean_process:62 - Cleaning CommandLineTool inp...
2025-08-12 16:36:55.930 | INFO | cwl_loader:load_cwl_from_yaml:144 - CWL document successfully dereferenced!
2. Inputs conversion¶
Once the document is parsed, invoke the cwl2ogc
APIs to convert the CWL inputs to the OGC JSON format:
In [2]:
Copied!
import sys
cwl_converter.dump_inputs(stream=sys.stdout, pretty_print=True)
import sys
cwl_converter.dump_inputs(stream=sys.stdout, pretty_print=True)
{ "example_flag": { "schema": { "type": "boolean" }, "metadata": [ { "title": "cwl:type", "value": "boolean" } ], "minOccurs": 1, "maxOccurs": 1, "valuePassing": "byValue", "title": "example_flag label", "description": "example_flag doc" }, "example_string": { "schema": { "type": "string" }, "metadata": [ { "title": "cwl:type", "value": "string" } ], "minOccurs": 1, "maxOccurs": 1, "valuePassing": "byValue", "title": "example_string label", "description": "example_string doc" }, "example_int": { "schema": { "type": "integer", "format": "int32" }, "metadata": [ { "title": "cwl:type", "value": "int" } ], "minOccurs": 1, "maxOccurs": 1, "valuePassing": "byValue", "title": "example_int label", "description": "example_int doc" }, "example_file": { "schema": { "nullable": true, "type": "string", "format": "uri" }, "metadata": [ { "title": "cwl:type", "value": "[ null, File ]" } ], "minOccurs": 0, "maxOccurs": 1, "valuePassing": "byValue", "title": "example_file label", "description": "example_file doc" }, "example_enum": { "schema": { "type": "string", "enum": [ "auto", "fasta", "fastq", "fasta.gz", "fastq.gz" ], "default": "auto" }, "metadata": [ { "title": "cwl:type", "value": "enum[ auto, fasta, fastq, fasta.gz, fastq.gz ]" } ], "minOccurs": 1, "maxOccurs": 1, "valuePassing": "byValue", "title": "example_enum label", "description": "example_enum doc" } }
3. Outputs conversion¶
Users can reuse the BaseCWLtypes2OGCConverter
instance to convert the CWL outputs to the OGC JSON format:
In [3]:
Copied!
cwl_converter.dump_outputs(stream=sys.stdout, pretty_print=True)
cwl_converter.dump_outputs(stream=sys.stdout, pretty_print=True)
{}