Skip to content

Commit b807e39

Browse files
committed
--print-targets: support embedded step processess
1 parent 2b9d7b0 commit b807e39

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

cwltool/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,9 +929,11 @@ def print_targets(
929929
_logger.info("%s steps targets:", prefix[:-1])
930930
for t in tool.tool["steps"]:
931931
stdout.write(f" {prefix}{shortname(t['id'])}\n")
932-
run: Union[str, Process] = t["run"]
932+
run: Union[str, Process, Dict[str, Any]] = t["run"]
933933
if isinstance(run, str):
934934
process = make_tool(run, loading_context)
935+
elif isinstance(run, dict):
936+
process = make_tool(cast(CommentedMap, cmap(run)), loading_context)
935937
else:
936938
process = run
937939
print_targets(process, stdout, loading_context, shortname(t["id"]) + "/")

tests/subgraph/timelimit2-wf.cwl

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env cwl-runner
2+
class: Workflow
3+
cwlVersion: v1.2
4+
5+
requirements:
6+
ToolTimeLimit:
7+
timelimit: 5
8+
InlineJavascriptRequirement: {}
9+
10+
inputs:
11+
i:
12+
type: string?
13+
14+
outputs:
15+
o:
16+
type: string?
17+
outputSource: step2/o
18+
19+
steps:
20+
step1:
21+
in:
22+
i: i
23+
out: [o]
24+
run:
25+
class: CommandLineTool
26+
baseCommand: ["sleep", "3"]
27+
inputs:
28+
i:
29+
type: string?
30+
outputs:
31+
o:
32+
type: string?
33+
outputBinding:
34+
outputEval: $("time passed")
35+
step2:
36+
in:
37+
i: step1/o
38+
out: [o]
39+
run:
40+
class: CommandLineTool
41+
baseCommand: ["sleep", "3"]
42+
inputs:
43+
i:
44+
type: string?
45+
outputs:
46+
o:
47+
type: string?
48+
outputBinding:
49+
outputEval: $("time passed")

tests/test_subgraph.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,14 @@ def test_single_step_packed_subwf_step() -> None:
240240
json.loads(stdout)["out"]["checksum"]
241241
== "sha1$7608e5669ba454c61fab01c9b133b52a9a7de68c"
242242
)
243+
244+
245+
def test_print_targets_embedded_step() -> None:
246+
"""Confirm that --print-targets works when a Workflow has embedded Processes."""
247+
err_code, stdout, stderr = get_main_output(
248+
[
249+
"--print-targets",
250+
get_data("tests/subgraph/timelimit2-wf.cwl"),
251+
]
252+
)
253+
assert err_code == 0

0 commit comments

Comments
 (0)