Skip to content

Commit

Permalink
CWLProv snapshots: capture the workflow even if the cwl:tool trick in…
Browse files Browse the repository at this point in the history
… the input object is used. (#1847)

Fixes: ResearchObject/runcrate#36
  • Loading branch information
mr-c authored May 26, 2023
1 parent 56cd06f commit 5667711
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cwltool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,9 @@ def loc_to_path(obj: CWLObjectType) -> None:
):
research_obj = runtimeContext.research_obj
if loadingContext.loader is not None:
research_obj.generate_snapshot(prov_deps(workflowobj, loadingContext.loader, uri))
research_obj.generate_snapshot(
prov_deps(cast(CWLObjectType, processobj), loadingContext.loader, uri)
)
else:
_logger.warning(
"Unable to generate provenance snapshot "
Expand Down
13 changes: 13 additions & 0 deletions tests/test_provenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@ def test_revsort_workflow(tmp_path: Path) -> None:
check_provenance(folder)


@needs_docker
def test_revsort_workflow_shortcut(tmp_path: Path) -> None:
"""Confirm that using 'cwl:tool' shortcut still snapshots the CWL files."""
folder = cwltool(
tmp_path,
get_data("tests/wf/revsort-job-shortcut.json"),
)
check_output_object(folder)
check_provenance(folder)
assert not (folder / "snapshot" / "revsort-job-shortcut.json").exists()
assert len(list((folder / "snapshot").iterdir())) == 4


@needs_docker
def test_nested_workflow(tmp_path: Path) -> None:
check_provenance(cwltool(tmp_path, get_data("tests/wf/nested.cwl")), nested=True)
Expand Down
8 changes: 8 additions & 0 deletions tests/wf/revsort-job-shortcut.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"cwl:tool": "revsort.cwl",
"workflow_input": {
"class": "File",
"location": "whale.txt",
"format": "https://www.iana.org/assignments/media-types/text/plain"
}
}

0 comments on commit 5667711

Please sign in to comment.