Skip to content

Commit 5667711

Browse files
authored
CWLProv snapshots: capture the workflow even if the cwl:tool trick in the input object is used. (#1847)
Fixes: ResearchObject/runcrate#36
1 parent 56cd06f commit 5667711

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

cwltool/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,9 @@ def loc_to_path(obj: CWLObjectType) -> None:
13891389
):
13901390
research_obj = runtimeContext.research_obj
13911391
if loadingContext.loader is not None:
1392-
research_obj.generate_snapshot(prov_deps(workflowobj, loadingContext.loader, uri))
1392+
research_obj.generate_snapshot(
1393+
prov_deps(cast(CWLObjectType, processobj), loadingContext.loader, uri)
1394+
)
13931395
else:
13941396
_logger.warning(
13951397
"Unable to generate provenance snapshot "

tests/test_provenance.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,19 @@ def test_revsort_workflow(tmp_path: Path) -> None:
8383
check_provenance(folder)
8484

8585

86+
@needs_docker
87+
def test_revsort_workflow_shortcut(tmp_path: Path) -> None:
88+
"""Confirm that using 'cwl:tool' shortcut still snapshots the CWL files."""
89+
folder = cwltool(
90+
tmp_path,
91+
get_data("tests/wf/revsort-job-shortcut.json"),
92+
)
93+
check_output_object(folder)
94+
check_provenance(folder)
95+
assert not (folder / "snapshot" / "revsort-job-shortcut.json").exists()
96+
assert len(list((folder / "snapshot").iterdir())) == 4
97+
98+
8699
@needs_docker
87100
def test_nested_workflow(tmp_path: Path) -> None:
88101
check_provenance(cwltool(tmp_path, get_data("tests/wf/nested.cwl")), nested=True)

tests/wf/revsort-job-shortcut.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"cwl:tool": "revsort.cwl",
3+
"workflow_input": {
4+
"class": "File",
5+
"location": "whale.txt",
6+
"format": "https://www.iana.org/assignments/media-types/text/plain"
7+
}
8+
}

0 commit comments

Comments
 (0)