Skip to content

Add conformance tests for the cwltool issue 1330 (eager vs. lazy eval of reqs and hints) #195

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

Closed
wants to merge 1 commit into from
Closed
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: 3 additions & 1 deletion conformance_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3314,7 +3314,7 @@
`echo a && echo b > out.txt`, but instead will produce the correct `echo a && echo b`,
and capture the output correctly.
tags: [ shell_command, command_line_tool ]

- label: multiple-input-feature-requirement
output: {
"hello_world_in_two_lines": [
Expand Down Expand Up @@ -3348,3 +3348,5 @@
Test SchemaDefRequirement with a workflow, with the `$import` under types.
It is similar to schemadef-wf, but the `$import` is different.
tags: [ workflow, schema_def ]

- $import: tests/eager-eval-reqs-hints/test-index.yaml
3 changes: 3 additions & 0 deletions tests/eager-eval-reqs-hints/10-cpus-job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"threads_max": 10
}
22 changes: 22 additions & 0 deletions tests/eager-eval-reqs-hints/cmdtool-hints.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cwlVersion: v1.2
class: CommandLineTool

hints:
ResourceRequirement:
coresMax: $(inputs.threads_max)

inputs:
threads_max:
type: int
default: 4

stdout: out.txt
outputs:
out:
type: string
outputBinding:
glob: out.txt
loadContents: true
outputEval: $(self[0].contents)

arguments: ['echo', $(runtime.cores)]
22 changes: 22 additions & 0 deletions tests/eager-eval-reqs-hints/cmdtool-reqs.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cwlVersion: v1.2
class: CommandLineTool

requirements:
ResourceRequirement:
coresMax: $(inputs.threads_max)

inputs:
threads_max:
type: int
default: 4

stdout: out.txt
outputs:
out:
type: string
outputBinding:
glob: out.txt
loadContents: true
outputEval: $(self[0].contents)

arguments: ['echo', $(runtime.cores)]
2 changes: 2 additions & 0 deletions tests/eager-eval-reqs-hints/empty-job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{}

20 changes: 20 additions & 0 deletions tests/eager-eval-reqs-hints/expr-hints.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cwlVersion: v1.2
class: ExpressionTool

requirements:
InlineJavascriptRequirement: {}

hints:
ResourceRequirement:
coresMax: $(inputs.threads_max)

inputs:
threads_max:
type: int
default: 4

outputs:
out: string

expression: |
${ return {"out": runtime.cores }}
18 changes: 18 additions & 0 deletions tests/eager-eval-reqs-hints/expr-reqs.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cwlVersion: v1.2
class: ExpressionTool

requirements:
InlineJavascriptRequirement: {}
ResourceRequirement:
coresMax: $(inputs.threads_max)

inputs:
threads_max:
type: int
default: 4

outputs:
out: string

expression: |
${ return {"out": runtime.cores }}
145 changes: 145 additions & 0 deletions tests/eager-eval-reqs-hints/test-index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# Run with cwltest --test test-index.yaml --tool cwltool

# --- workflow
# ----- using requirements
# ------- with default values
- job: empty-job.yml
tool: wf-reqs.cwl
label: eager_reqs_wf_reqs_default_threads
doc: Test a workflow with requirements using the default values
output:
{
"out": "4\n"
}
tags: [ resource, workflow ]
id: eager-eval-reqs-hints-1
# ------- with provided inputs
- job: 10-cpus-job.yml
tool: wf-reqs.cwl
label: eager_reqs_wf_reqs_10_threads
doc: Test a workflow with requirements using 10 threads
output:
{
"out": "10\n"
}
tags: [ resource, workflow ]
id: eager-eval-reqs-hints-2
# ----- using hints
# ------- with default values
- job: empty-job.yml
tool: wf-hints.cwl
label: eager_reqs_wf_hints_default_threads
doc: Test a workflow with hints using the default values
output:
{
"out": "4\n"
}
tags: [ resource, workflow ]
id: eager-eval-reqs-hints-3
# ------- with provided inputs
- job: 10-cpus-job.yml
tool: wf-hints.cwl
label: eager_reqs_wf_hints_10_threads
doc: Test a workflow with hints using 10 threads
output:
{
"out": "10\n"
}
tags: [ resource, workflow ]
id: eager-eval-reqs-hints-4

# --- command-line tool
# ----- using requirements
# ------- with default values
- job: empty-job.yml
tool: cmdtool-reqs.cwl
label: eager_reqs_cmdtool_reqs_default_threads
doc: Test a cmdtool with requirements using the default values
output:
{
"out": "4\n"
}
tags: [ resource, command_line_tool ]
id: eager-eval-reqs-hints-5
# ------- with provided inputs
- job: 10-cpus-job.yml
tool: cmdtool-reqs.cwl
label: eager_reqs_cmdtool_reqs_10_threads
doc: Test a cmdtool with requirements using 10 threads
output:
{
"out": "10\n"
}
tags: [ resource, command_line_tool ]
id: eager-eval-reqs-hints-6
# ----- using hints
# ------- with default values
- job: empty-job.yml
tool: cmdtool-hints.cwl
label: eager_reqs_cmdtool_hints_default_threads
doc: Test a cmdtool with hints using the default values
output:
{
"out": "4\n"
}
tags: [ resource, command_line_tool ]
id: eager-eval-reqs-hints-7
# ------- with provided inputs
- job: 10-cpus-job.yml
tool: cmdtool-hints.cwl
label: eager_reqs_cmdtool_hints_10_threads
doc: Test a cmdtool with hints using 10 threads
output:
{
"out": "10\n"
}
tags: [ resource, command_line_tool ]
id: eager-eval-reqs-hints-8

# --- expression tool
# ----- using requirements
# ------- with default values
- job: empty-job.yml
tool: expr-reqs.cwl
label: eager_reqs_expr_reqs_default_threads
doc: Test a expr with requirements using the default values
output:
{
"out": 4
}
tags: [ resource, expression_tool ]
id: eager-eval-reqs-hints-9
# ------- with provided inputs
- job: 10-cpus-job.yml
tool: expr-reqs.cwl
label: eager_reqs_expr_reqs_10_threads
doc: Test a expr with requirements using 10 threads
output:
{
"out": 10
}
tags: [ resource, expression_tool ]
id: eager-eval-reqs-hints-10
# ----- using hints
# ------- with default values
- job: empty-job.yml
tool: expr-hints.cwl
label: eager_reqs_expr_hints_default_threads
doc: Test a expr with hints using the default values
output:
{
"out": 4
}
tags: [ resource, expression_tool ]
id: eager-eval-reqs-hints-11
# ------- with provided inputs
- job: 10-cpus-job.yml
tool: expr-hints.cwl
label: eager_reqs_expr_hints_10_threads
doc: Test a expr with hints using 10 threads
output:
{
"out": 10
}
tags: [ resource, expression_tool ]
id: eager-eval-reqs-hints-12
38 changes: 38 additions & 0 deletions tests/eager-eval-reqs-hints/wf-hints.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
cwlVersion: v1.2
class: Workflow

hints:
ResourceRequirement:
coresMax: $(inputs.threads_max)

inputs:
threads_max:
type: int
default: 4

steps:
one:
in: []
run:
class: CommandLineTool
inputs:
other_input:
type: int
default: 8
baseCommand: echo
arguments: [ $(runtime.cores) ]
stdout: out.txt
outputs:
out:
type: string
outputBinding:
glob: out.txt
loadContents: true
outputEval: $(self[0].contents)
out: [out]

outputs:
out:
type: string
outputSource: one/out

39 changes: 39 additions & 0 deletions tests/eager-eval-reqs-hints/wf-reqs.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cwlVersion: v1.2
class: Workflow

requirements:
# InlineJavascriptRequirement: {}
ResourceRequirement:
coresMax: $(inputs.threads_max)

inputs:
threads_max:
type: int
default: 4

steps:
one:
in: []
run:
class: CommandLineTool
inputs:
other_input:
type: int
default: 8
baseCommand: echo
arguments: [ $(runtime.cores) ]
stdout: out.txt
outputs:
out:
type: string
outputBinding:
glob: out.txt
loadContents: true
outputEval: $(self[0].contents)
out: [out]

outputs:
out:
type: string
outputSource: one/out