Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5cb0a70

Browse files
committedDec 9, 2024·
Added extension tests
1 parent fb2e645 commit 5cb0a70

28 files changed

+628
-4
lines changed
 

‎MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ include testdata/workflows/*.cwl
2121
include testdata/workflows/*.yaml
2222
include testdata/types/*.yml
2323
include testdata/checker_wf/*.cwl
24+
include testdata/extensions/*.cwl
2425
include cwl_utils/py.typed
2526
include docs/conf.py docs/Makefile docs/_static/favicon.ico docs/requirements.txt
2627
include docs/*.rst

‎Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,19 @@ flake8: $(PYSOURCES)
191191
cwl_utils/parser/cwl_v1_0.py: FORCE
192192
schema-salad-tool --codegen python \
193193
--codegen-parser-info "org.w3id.cwl.v1_0" \
194-
https://github.com/common-workflow-language/common-workflow-language/raw/codegen/v1.0/CommonWorkflowLanguage.yml \
194+
https://github.com/common-workflow-language/common-workflow-language/raw/codegen/v1.0/extensions.yml \
195195
> $@
196196

197197
cwl_utils/parser/cwl_v1_1.py: FORCE
198198
schema-salad-tool --codegen python \
199199
--codegen-parser-info "org.w3id.cwl.v1_1" \
200-
https://github.com/common-workflow-language/cwl-v1.1/raw/codegen/CommonWorkflowLanguage.yml \
200+
https://github.com/common-workflow-language/cwl-v1.1/raw/codegen/extensions.yml \
201201
> $@
202202

203203
cwl_utils/parser/cwl_v1_2.py: FORCE
204204
schema-salad-tool --codegen python \
205205
--codegen-parser-info "org.w3id.cwl.v1_2" \
206-
https://github.com/common-workflow-language/cwl-v1.2/raw/codegen/CommonWorkflowLanguage.yml \
206+
https://github.com/common-workflow-language/cwl-v1.2/raw/codegen/extensions.yml \
207207
> $@
208208

209209
regen_parsers: cwl_utils/parser/cwl_v1_*.py

‎pyproject.toml

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ packages = [
6767
"cwl_utils.tests",
6868
"cwl_utils.testdata",
6969
"cwl_utils.testdata.checker_wf",
70+
"cwl_utils.testdata.extensions",
7071
"cwl_utils.testdata.types",
7172
"cwl_utils.testdata.workflows",
7273
]
@@ -77,6 +78,7 @@ include-package-data = true
7778
"cwl_utils.tests" = "tests"
7879
"cwl_utils.testdata" = "testdata"
7980
"cwl_utils.testdata.checker_wf" = "testdata/checker_wf"
81+
"cwl_utils.testdata.extensions" = "testdata/extensions"
8082
"cwl_utils.testdata.types" = "testdata/types"
8183
"cwl_utils.testdata.workflows" = "testdata/workflows"
8284

‎requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ cwl-upgrader >= 1.2.3
22
packaging
33
rdflib
44
requests
5-
schema-salad @ git+https://github.com/common-workflow-language/schema_salad.git
5+
schema-salad >= 8.8.20241206093842, < 9
66
ruamel.yaml >= 0.17.6, < 0.19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.2
3+
class: Workflow
4+
$namespaces:
5+
cwltool: "http://commonwl.org/cwltool#"
6+
requirements:
7+
InlineJavascriptRequirement: {}
8+
inputs:
9+
i1: int
10+
outputs:
11+
o1:
12+
type: int[]
13+
outputSource: subworkflow/o1
14+
steps:
15+
subworkflow:
16+
run:
17+
class: ExpressionTool
18+
inputs:
19+
i1: int
20+
outputs:
21+
o1: int
22+
expression: >
23+
${return {'o1': inputs.i1 + 1};}
24+
in:
25+
i1: i1
26+
out: [o1]
27+
requirements:
28+
cwltool:Loop:
29+
loopWhen: $(inputs.i1 < 10)
30+
loop:
31+
i1: o1
32+
outputMethod: all
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.0
3+
class: CommandLineTool
4+
$namespaces:
5+
cwltool: "http://commonwl.org/cwltool#"
6+
requirements:
7+
cwltool:CUDARequirement:
8+
cudaVersionMin: "1.0"
9+
cudaComputeCapability: "1.0"
10+
cudaDeviceCountMin: $(inputs.gpus)
11+
inputs:
12+
gpus:
13+
type: int
14+
default: 1
15+
outputs: []
16+
baseCommand: "nvidia-smi"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.1
3+
class: CommandLineTool
4+
$namespaces:
5+
cwltool: "http://commonwl.org/cwltool#"
6+
requirements:
7+
cwltool:CUDARequirement:
8+
cudaVersionMin: "1.0"
9+
cudaComputeCapability: "1.0"
10+
cudaDeviceCountMin: $(inputs.gpus)
11+
inputs:
12+
gpus:
13+
type: int
14+
default: 1
15+
outputs: []
16+
baseCommand: "nvidia-smi"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.2
3+
class: CommandLineTool
4+
$namespaces:
5+
cwltool: "http://commonwl.org/cwltool#"
6+
requirements:
7+
cwltool:CUDARequirement:
8+
cudaVersionMin: "1.0"
9+
cudaComputeCapability: "1.0"
10+
cudaDeviceCountMin: $(inputs.gpus)
11+
inputs:
12+
gpus:
13+
type: int
14+
default: 1
15+
outputs: []
16+
baseCommand: "nvidia-smi"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env cwl-runner
2+
class: CommandLineTool
3+
cwlVersion: v1.0
4+
$namespaces:
5+
cwltool: "http://commonwl.org/cwltool#"
6+
requirements:
7+
cwltool:InplaceUpdateRequirement:
8+
inplaceUpdate: true
9+
inputs:
10+
r: File
11+
script:
12+
type: File
13+
default:
14+
class: File
15+
location: updateval.py
16+
outputs:
17+
out:
18+
type: File
19+
outputBinding:
20+
glob: $(inputs.r.basename)
21+
arguments: [python, $(inputs.script), $(inputs.r.basename)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env cwl-runner
2+
class: CommandLineTool
3+
cwlVersion: v1.0
4+
$namespaces:
5+
cwltool: http://commonwl.org/cwltool#
6+
requirements:
7+
cwltool:LoadListingRequirement:
8+
loadListing: shallow_listing
9+
inputs:
10+
d: Directory
11+
outputs: []
12+
arguments:
13+
[echo, "$(inputs.d.listing[0].listing[0])"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env cwl-runner
2+
class: CommandLineTool
3+
cwlVersion: v1.0
4+
$namespaces:
5+
cwltool: "http://commonwl.org/cwltool#"
6+
7+
baseCommand: env
8+
requirements:
9+
cwltool:MPIRequirement:
10+
processes: 1
11+
inputs: {}
12+
outputs:
13+
environment:
14+
type: stdout
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env cwl-runner
2+
class: CommandLineTool
3+
cwlVersion: v1.1
4+
$namespaces:
5+
cwltool: "http://commonwl.org/cwltool#"
6+
baseCommand: env
7+
requirements:
8+
cwltool:MPIRequirement:
9+
processes: 1
10+
inputs: {}
11+
outputs:
12+
environment:
13+
type: stdout
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env cwl-runner
2+
class: CommandLineTool
3+
cwlVersion: v1.2
4+
$namespaces:
5+
cwltool: "http://commonwl.org/cwltool#"
6+
baseCommand: env
7+
requirements:
8+
cwltool:MPIRequirement:
9+
processes: 1
10+
inputs: {}
11+
outputs:
12+
environment:
13+
type: stdout
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env cwl-runner
2+
class: CommandLineTool
3+
cwlVersion: v1.0
4+
$namespaces:
5+
cwltool: "http://commonwl.org/cwltool#"
6+
requirements:
7+
cwltool:NetworkAccess:
8+
networkAccess: true
9+
inputs: []
10+
outputs: []
11+
baseCommand: python
12+
arguments:
13+
- "-c"
14+
- valueFrom: |
15+
import urllib.request
16+
assert(urllib.request.urlopen("http://commonwl.org").code == 200)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.0
3+
$namespaces:
4+
cwltool: "http://commonwl.org/cwltool#"
5+
class: cwltool:ProcessGenerator
6+
inputs:
7+
script: string
8+
dir: Directory
9+
outputs: {}
10+
run:
11+
class: CommandLineTool
12+
inputs:
13+
script: string
14+
dir: Directory
15+
outputs:
16+
runProcess:
17+
type: File
18+
outputBinding:
19+
glob: main.cwl
20+
requirements:
21+
InlineJavascriptRequirement: {}
22+
LoadListingRequirement:
23+
loadListing: shallow_listing
24+
InitialWorkDirRequirement:
25+
listing: |
26+
${
27+
var v = inputs.dir.listing;
28+
v.push({entryname: "inp.py", entry: inputs.script});
29+
return v;
30+
}
31+
arguments: [python3, inp.py]
32+
stdout: main.cwl
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.1
3+
$namespaces:
4+
cwltool: "http://commonwl.org/cwltool#"
5+
class: cwltool:ProcessGenerator
6+
inputs:
7+
script: string
8+
dir: Directory
9+
outputs: {}
10+
run:
11+
class: CommandLineTool
12+
inputs:
13+
script: string
14+
dir: Directory
15+
outputs:
16+
runProcess:
17+
type: File
18+
outputBinding:
19+
glob: main.cwl
20+
requirements:
21+
InlineJavascriptRequirement: {}
22+
LoadListingRequirement:
23+
loadListing: shallow_listing
24+
InitialWorkDirRequirement:
25+
listing: |
26+
${
27+
var v = inputs.dir.listing;
28+
v.push({entryname: "inp.py", entry: inputs.script});
29+
return v;
30+
}
31+
arguments: [python3, inp.py]
32+
stdout: main.cwl
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.2
3+
$namespaces:
4+
cwltool: "http://commonwl.org/cwltool#"
5+
class: cwltool:ProcessGenerator
6+
inputs:
7+
script: string
8+
dir: Directory
9+
outputs: {}
10+
run:
11+
class: CommandLineTool
12+
inputs:
13+
script: string
14+
dir: Directory
15+
outputs:
16+
runProcess:
17+
type: File
18+
outputBinding:
19+
glob: main.cwl
20+
requirements:
21+
InlineJavascriptRequirement: {}
22+
LoadListingRequirement:
23+
loadListing: shallow_listing
24+
InitialWorkDirRequirement:
25+
listing: |
26+
${
27+
var v = inputs.dir.listing;
28+
v.push({entryname: "inp.py", entry: inputs.script});
29+
return v;
30+
}
31+
arguments: [python3, inp.py]
32+
stdout: main.cwl

‎testdata/extensions/secrets_v1_0.cwl

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.0
3+
class: CommandLineTool
4+
$namespaces:
5+
cwltool: http://commonwl.org/cwltool#
6+
requirements:
7+
cwltool:Secrets:
8+
secrets: [pw]
9+
inputs:
10+
pw: string
11+
outputs:
12+
out: stdout
13+
arguments: [cat, example.conf]

‎testdata/extensions/secrets_v1_1.cwl

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.1
3+
class: CommandLineTool
4+
$namespaces:
5+
cwltool: http://commonwl.org/cwltool#
6+
requirements:
7+
cwltool:Secrets:
8+
secrets: [pw]
9+
inputs:
10+
pw: string
11+
outputs:
12+
out: stdout
13+
arguments: [cat, example.conf]

‎testdata/extensions/secrets_v1_2.cwl

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.2
3+
class: CommandLineTool
4+
$namespaces:
5+
cwltool: http://commonwl.org/cwltool#
6+
requirements:
7+
cwltool:Secrets:
8+
secrets: [pw]
9+
inputs:
10+
pw: string
11+
outputs:
12+
out: stdout
13+
arguments: [cat, example.conf]
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Please sign in to comment.