Skip to content

Commit da69490

Browse files
committed
Add conformance tests for the cwltool issue 1330 (eager vs. lazy eval of reqs and hints)
1 parent 6f15395 commit da69490

File tree

10 files changed

+312
-1
lines changed

10 files changed

+312
-1
lines changed

conformance_tests.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3314,7 +3314,7 @@
33143314
`echo a && echo b > out.txt`, but instead will produce the correct `echo a && echo b`,
33153315
and capture the output correctly.
33163316
tags: [ shell_command, command_line_tool ]
3317-
3317+
33183318
- label: multiple-input-feature-requirement
33193319
output: {
33203320
"hello_world_in_two_lines": [
@@ -3348,3 +3348,5 @@
33483348
Test SchemaDefRequirement with a workflow, with the `$import` under types.
33493349
It is similar to schemadef-wf, but the `$import` is different.
33503350
tags: [ workflow, schema_def ]
3351+
3352+
- $import: tests/eager-eval-reqs-hints/test-index.yaml
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"threads_max": 10
3+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
cwlVersion: v1.2
2+
class: CommandLineTool
3+
4+
hints:
5+
ResourceRequirement:
6+
coresMax: $(inputs.threads_max)
7+
8+
inputs:
9+
threads_max:
10+
type: int
11+
default: 4
12+
13+
stdout: out.txt
14+
outputs:
15+
out:
16+
type: string
17+
outputBinding:
18+
glob: out.txt
19+
loadContents: true
20+
outputEval: $(self[0].contents)
21+
22+
arguments: ['echo', $(runtime.cores)]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
cwlVersion: v1.2
2+
class: CommandLineTool
3+
4+
requirements:
5+
ResourceRequirement:
6+
coresMax: $(inputs.threads_max)
7+
8+
inputs:
9+
threads_max:
10+
type: int
11+
default: 4
12+
13+
stdout: out.txt
14+
outputs:
15+
out:
16+
type: string
17+
outputBinding:
18+
glob: out.txt
19+
loadContents: true
20+
outputEval: $(self[0].contents)
21+
22+
arguments: ['echo', $(runtime.cores)]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{}
2+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cwlVersion: v1.2
2+
class: ExpressionTool
3+
4+
requirements:
5+
InlineJavascriptRequirement: {}
6+
7+
hints:
8+
ResourceRequirement:
9+
coresMax: $(inputs.threads_max)
10+
11+
inputs:
12+
threads_max:
13+
type: int
14+
default: 4
15+
16+
outputs:
17+
out: string
18+
19+
expression: |
20+
${ return {"out": runtime.cores }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cwlVersion: v1.2
2+
class: ExpressionTool
3+
4+
requirements:
5+
InlineJavascriptRequirement: {}
6+
ResourceRequirement:
7+
coresMax: $(inputs.threads_max)
8+
9+
inputs:
10+
threads_max:
11+
type: int
12+
default: 4
13+
14+
outputs:
15+
out: string
16+
17+
expression: |
18+
${ return {"out": runtime.cores }}
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Run with cwltest --test test-index.yaml --tool cwltool
2+
3+
# --- workflow
4+
# ----- using requirements
5+
# ------- with default values
6+
- job: empty-job.yml
7+
tool: wf-reqs.cwl
8+
label: eager_reqs_wf_reqs_default_threads
9+
doc: Test a workflow with requirements using the default values
10+
output:
11+
{
12+
"out": "4\n"
13+
}
14+
tags: [ resource, workflow ]
15+
id: eager-eval-reqs-hints-1
16+
# ------- with provided inputs
17+
- job: 10-cpus-job.yml
18+
tool: wf-reqs.cwl
19+
label: eager_reqs_wf_reqs_10_threads
20+
doc: Test a workflow with requirements using 10 threads
21+
output:
22+
{
23+
"out": "10\n"
24+
}
25+
tags: [ resource, workflow ]
26+
id: eager-eval-reqs-hints-2
27+
# ----- using hints
28+
# ------- with default values
29+
- job: empty-job.yml
30+
tool: wf-hints.cwl
31+
label: eager_reqs_wf_hints_default_threads
32+
doc: Test a workflow with hints using the default values
33+
output:
34+
{
35+
"out": "4\n"
36+
}
37+
tags: [ resource, workflow ]
38+
id: eager-eval-reqs-hints-3
39+
# ------- with provided inputs
40+
- job: 10-cpus-job.yml
41+
tool: wf-hints.cwl
42+
label: eager_reqs_wf_hints_10_threads
43+
doc: Test a workflow with hints using 10 threads
44+
output:
45+
{
46+
"out": "10\n"
47+
}
48+
tags: [ resource, workflow ]
49+
id: eager-eval-reqs-hints-4
50+
51+
# --- command-line tool
52+
# ----- using requirements
53+
# ------- with default values
54+
- job: empty-job.yml
55+
tool: cmdtool-reqs.cwl
56+
label: eager_reqs_cmdtool_reqs_default_threads
57+
doc: Test a cmdtool with requirements using the default values
58+
output:
59+
{
60+
"out": "4\n"
61+
}
62+
tags: [ resource, command_line_tool ]
63+
id: eager-eval-reqs-hints-5
64+
# ------- with provided inputs
65+
- job: 10-cpus-job.yml
66+
tool: cmdtool-reqs.cwl
67+
label: eager_reqs_cmdtool_reqs_10_threads
68+
doc: Test a cmdtool with requirements using 10 threads
69+
output:
70+
{
71+
"out": "10\n"
72+
}
73+
tags: [ resource, command_line_tool ]
74+
id: eager-eval-reqs-hints-6
75+
# ----- using hints
76+
# ------- with default values
77+
- job: empty-job.yml
78+
tool: cmdtool-hints.cwl
79+
label: eager_reqs_cmdtool_hints_default_threads
80+
doc: Test a cmdtool with hints using the default values
81+
output:
82+
{
83+
"out": "4\n"
84+
}
85+
tags: [ resource, command_line_tool ]
86+
id: eager-eval-reqs-hints-7
87+
# ------- with provided inputs
88+
- job: 10-cpus-job.yml
89+
tool: cmdtool-hints.cwl
90+
label: eager_reqs_cmdtool_hints_10_threads
91+
doc: Test a cmdtool with hints using 10 threads
92+
output:
93+
{
94+
"out": "10\n"
95+
}
96+
tags: [ resource, command_line_tool ]
97+
id: eager-eval-reqs-hints-8
98+
99+
# --- expression tool
100+
# ----- using requirements
101+
# ------- with default values
102+
- job: empty-job.yml
103+
tool: expr-reqs.cwl
104+
label: eager_reqs_expr_reqs_default_threads
105+
doc: Test a expr with requirements using the default values
106+
output:
107+
{
108+
"out": 4
109+
}
110+
tags: [ resource, expression_tool ]
111+
id: eager-eval-reqs-hints-9
112+
# ------- with provided inputs
113+
- job: 10-cpus-job.yml
114+
tool: expr-reqs.cwl
115+
label: eager_reqs_expr_reqs_10_threads
116+
doc: Test a expr with requirements using 10 threads
117+
output:
118+
{
119+
"out": 10
120+
}
121+
tags: [ resource, expression_tool ]
122+
id: eager-eval-reqs-hints-10
123+
# ----- using hints
124+
# ------- with default values
125+
- job: empty-job.yml
126+
tool: expr-hints.cwl
127+
label: eager_reqs_expr_hints_default_threads
128+
doc: Test a expr with hints using the default values
129+
output:
130+
{
131+
"out": 4
132+
}
133+
tags: [ resource, expression_tool ]
134+
id: eager-eval-reqs-hints-11
135+
# ------- with provided inputs
136+
- job: 10-cpus-job.yml
137+
tool: expr-hints.cwl
138+
label: eager_reqs_expr_hints_10_threads
139+
doc: Test a expr with hints using 10 threads
140+
output:
141+
{
142+
"out": 10
143+
}
144+
tags: [ resource, expression_tool ]
145+
id: eager-eval-reqs-hints-12
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
cwlVersion: v1.2
2+
class: Workflow
3+
4+
hints:
5+
ResourceRequirement:
6+
coresMax: $(inputs.threads_max)
7+
8+
inputs:
9+
threads_max:
10+
type: int
11+
default: 4
12+
13+
steps:
14+
one:
15+
in: []
16+
run:
17+
class: CommandLineTool
18+
inputs:
19+
other_input:
20+
type: int
21+
default: 8
22+
baseCommand: echo
23+
arguments: [ $(runtime.cores) ]
24+
stdout: out.txt
25+
outputs:
26+
out:
27+
type: string
28+
outputBinding:
29+
glob: out.txt
30+
loadContents: true
31+
outputEval: $(self[0].contents)
32+
out: [out]
33+
34+
outputs:
35+
out:
36+
type: string
37+
outputSource: one/out
38+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
cwlVersion: v1.2
2+
class: Workflow
3+
4+
requirements:
5+
# InlineJavascriptRequirement: {}
6+
ResourceRequirement:
7+
coresMax: $(inputs.threads_max)
8+
9+
inputs:
10+
threads_max:
11+
type: int
12+
default: 4
13+
14+
steps:
15+
one:
16+
in: []
17+
run:
18+
class: CommandLineTool
19+
inputs:
20+
other_input:
21+
type: int
22+
default: 8
23+
baseCommand: echo
24+
arguments: [ $(runtime.cores) ]
25+
stdout: out.txt
26+
outputs:
27+
out:
28+
type: string
29+
outputBinding:
30+
glob: out.txt
31+
loadContents: true
32+
outputEval: $(self[0].contents)
33+
out: [out]
34+
35+
outputs:
36+
out:
37+
type: string
38+
outputSource: one/out
39+

0 commit comments

Comments
 (0)