Skip to content

Commit c0a934a

Browse files
authored
Merge pull request #51 from common-workflow-language/timelimit-wf-tests
Time limit Workflow and ExpressionTool tests
2 parents 6076d2f + c289111 commit c0a934a

File tree

6 files changed

+212
-0
lines changed

6 files changed

+212
-0
lines changed

conformance_tests.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2810,6 +2810,44 @@
28102810
doc: Test expression in time limit
28112811
tags: [ command_line_tool, timelimit, inline_javascript ]
28122812

2813+
- job: tests/empty.json
2814+
output:
2815+
status: Done
2816+
tool: tests/timelimit5.cwl
2817+
label: timelimit_expressiontool
2818+
doc: Test timelimit in expressiontool is ignored
2819+
tags: [ expression_tool, timelimit, inline_javascript ]
2820+
2821+
- job: tests/empty.json
2822+
should_fail: true
2823+
tool: tests/timelimit-wf.cwl
2824+
label: timelimit_basic_wf
2825+
doc: Test that tool in workflow fails when exceeding time limit
2826+
tags: [ workflow, timelimit ]
2827+
2828+
- job: tests/empty.json
2829+
output:
2830+
o: time passed
2831+
tool: tests/timelimit2-wf.cwl
2832+
label: timelimit_invalid_wf
2833+
doc: Test that workflow level time limit is not applied to workflow execution time
2834+
tags: [ workflow, timelimit ]
2835+
2836+
- job: tests/empty.json
2837+
output:
2838+
o: time passed
2839+
tool: tests/timelimit3-wf.cwl
2840+
label: timelimit_zero_unlimited_wf
2841+
doc: Test zero timelimit means no limit in workflow
2842+
tags: [ workflow, timelimit ]
2843+
2844+
- job: tests/empty.json
2845+
should_fail: true
2846+
tool: tests/timelimit4-wf.cwl
2847+
label: timelimit_from_expression_wf
2848+
doc: Test expression in time limit in workflow
2849+
tags: [ workflow, timelimit, inline_javascript ]
2850+
28132851
- job: tests/empty.json
28142852
output: {}
28152853
tool: tests/networkaccess.cwl

tests/timelimit-wf.cwl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env cwl-runner
2+
class: Workflow
3+
cwlVersion: v1.1.0-dev1
4+
5+
requirements:
6+
ToolTimeLimit:
7+
timelimit: 3
8+
9+
inputs:
10+
i:
11+
type: int?
12+
13+
outputs:
14+
o:
15+
type: string?
16+
outputSource: step1/o
17+
18+
steps:
19+
step1:
20+
in:
21+
i: i
22+
out: [o]
23+
run:
24+
class: CommandLineTool
25+
baseCommand: ["sleep", "10"]
26+
inputs:
27+
i:
28+
type: int?
29+
outputs:
30+
o:
31+
type: string?
32+
outputBinding:
33+
outputEval: "time passed"
34+

tests/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.1.0-dev1
4+
5+
requirements:
6+
ToolTimeLimit:
7+
timelimit: 5
8+
9+
inputs:
10+
i:
11+
type: string?
12+
13+
outputs:
14+
o:
15+
type: string?
16+
outputSource: step2/o
17+
18+
steps:
19+
step1:
20+
in:
21+
i: i
22+
out: [o]
23+
run:
24+
class: CommandLineTool
25+
baseCommand: ["sleep", "3"]
26+
inputs:
27+
i:
28+
type: string?
29+
outputs:
30+
o:
31+
type: string?
32+
outputBinding:
33+
outputEval: "time passed"
34+
step2:
35+
in:
36+
i: step1/o
37+
out: [o]
38+
run:
39+
class: CommandLineTool
40+
baseCommand: ["sleep", "3"]
41+
inputs:
42+
i:
43+
type: string?
44+
outputs:
45+
o:
46+
type: string?
47+
outputBinding:
48+
outputEval: "time passed"
49+

tests/timelimit3-wf.cwl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env cwl-runner
2+
class: Workflow
3+
cwlVersion: v1.1.0-dev1
4+
5+
requirements:
6+
ToolTimeLimit:
7+
timelimit: 0
8+
9+
inputs:
10+
i:
11+
type: int?
12+
13+
outputs:
14+
o:
15+
type: string?
16+
outputSource: step1/o
17+
18+
steps:
19+
step1:
20+
in:
21+
i: i
22+
out: [o]
23+
run:
24+
class: CommandLineTool
25+
baseCommand: ["sleep", "10"]
26+
inputs:
27+
i:
28+
type: int?
29+
outputs:
30+
o:
31+
type: string?
32+
outputBinding:
33+
outputEval: "time passed"
34+

tests/timelimit4-wf.cwl

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

tests/timelimit5.cwl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class: ExpressionTool
2+
cwlVersion: v1.1.0-dev1
3+
inputs: []
4+
outputs:
5+
status: string
6+
requirements:
7+
ToolTimeLimit:
8+
timelimit: 3
9+
InlineJavascriptRequirement: {}
10+
expression: |
11+
${
12+
function sleep(milliseconds) {
13+
var start = new Date().getTime();
14+
for (var i = 0; i < 1e7; i++) {
15+
if ((new Date().getTime() - start) > milliseconds){
16+
break;
17+
}
18+
}
19+
};
20+
sleep(5000);
21+
return {"status": "Done"}
22+
}

0 commit comments

Comments
 (0)