Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

abstract CWL test: recusively validate #93

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Optional dependencies
schema-salad[pycodegen]
# Needs to validate v1.2
cwltool>=3.0.20200807132242
# Needs to validate v1.2, recursive_resolve_and_validate_document
cwltool>=3.0.20201117141248


mypy
Expand Down
8 changes: 6 additions & 2 deletions gxformat2/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,18 @@ def _format2_step_to_abstract(format2_step, requirements):
step_run = {
"class": "Operation",
"doc": format2_step.get("doc", ""),
"inputs": {}, # TODO
"outputs": {}, # TODO
"inputs": _format2_wfstep_inputs_to_abstract(format2_step),
"outputs": { out: "Any" for out in format2_step["out"] }
}
abstract_step["run"] = step_run
abstract_step["in"] = _format2_in_to_abstract(format2_step.get("in", []))
abstract_step["out"] = _format2_out_to_abstract(format2_step)
return abstract_step

def _format2_wfstep_inputs_to_abstract(format2_step):
if "in" in format2_step:
return { name: "Any" for name in format2_step["in"].keys() }
return {}

def _format2_in_to_abstract(in_dict):
"""Convert Format2 'in' dict for step into CWL abstract 'in' dict."""
Expand Down
6 changes: 6 additions & 0 deletions tests/example_wfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
doc: cat doc
in:
input1: the_input
out:
out_file1: {}
"""

WORKFLOW_WITH_REPEAT = """
Expand Down Expand Up @@ -100,6 +102,8 @@
mapping:
- type: list_identifiers
columns: [0, 1]
out:
output: {}
random_lines:
tool_id: random_lines1
state:
Expand All @@ -109,6 +113,8 @@
seed_source:
seed_source_selector: set_seed
seed: asdf
out:
out_file1: {}
"""

RUNTIME_INPUTS = """
Expand Down
4 changes: 2 additions & 2 deletions tests/test_export_abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
getdefault,
LoadingContext,
)
from cwltool.load_tool import recursive_resolve_and_validate_document
from cwltool.main import (
default_loader,
fetch_document,
resolve_and_validate_document,
tool_resolver,
)

Expand Down Expand Up @@ -140,7 +140,7 @@ def _run_example(as_dict, out=None):
)
loadingContext.resolver = getdefault(loadingContext.resolver, tool_resolver)
loadingContext, workflowobj, uri = fetch_document(out, loadingContext)
loadingContext, uri = resolve_and_validate_document(
loadingContext, uri, process = recursive_resolve_and_validate_document(
loadingContext,
workflowobj,
uri,
Expand Down
Loading