Skip to content

Commit

Permalink
Added extension tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GlassOfWhiskey committed Dec 9, 2024
1 parent fb2e645 commit 1f9362d
Show file tree
Hide file tree
Showing 27 changed files with 625 additions and 1 deletion.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ include testdata/workflows/*.cwl
include testdata/workflows/*.yaml
include testdata/types/*.yml
include testdata/checker_wf/*.cwl
include testdata/extensions/*.cwl
include cwl_utils/py.typed
include docs/conf.py docs/Makefile docs/_static/favicon.ico docs/requirements.txt
include docs/*.rst
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ packages = [
"cwl_utils.tests",
"cwl_utils.testdata",
"cwl_utils.testdata.checker_wf",
"cwl_utils.testdata.extensions",
"cwl_utils.testdata.types",
"cwl_utils.testdata.workflows",
]
Expand All @@ -77,6 +78,7 @@ include-package-data = true
"cwl_utils.tests" = "tests"
"cwl_utils.testdata" = "testdata"
"cwl_utils.testdata.checker_wf" = "testdata/checker_wf"
"cwl_utils.testdata.extensions" = "testdata/extensions"
"cwl_utils.testdata.types" = "testdata/types"
"cwl_utils.testdata.workflows" = "testdata/workflows"

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ cwl-upgrader >= 1.2.3
packaging
rdflib
requests
schema-salad @ git+https://github.com/common-workflow-language/schema_salad.git
schema-salad >= 8.8.20241206093842, < 9
ruamel.yaml >= 0.17.6, < 0.19
32 changes: 32 additions & 0 deletions testdata/extensions/all-output-loop_v1_2.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.2
class: Workflow
$namespaces:
cwltool: "http://commonwl.org/cwltool#"
requirements:
InlineJavascriptRequirement: {}
inputs:
i1: int
outputs:
o1:
type: int[]
outputSource: subworkflow/o1
steps:
subworkflow:
run:
class: ExpressionTool
inputs:
i1: int
outputs:
o1: int
expression: >
${return {'o1': inputs.i1 + 1};}
in:
i1: i1
out: [o1]
requirements:
cwltool:Loop:
loopWhen: $(inputs.i1 < 10)
loop:
i1: o1
outputMethod: all
16 changes: 16 additions & 0 deletions testdata/extensions/cuda-requirement_v1_0.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
$namespaces:
cwltool: "http://commonwl.org/cwltool#"
requirements:
cwltool:CUDARequirement:
cudaVersionMin: "1.0"
cudaComputeCapability: "1.0"
cudaDeviceCountMin: $(inputs.gpus)
inputs:
gpus:
type: int
default: 1
outputs: []
baseCommand: "nvidia-smi"
16 changes: 16 additions & 0 deletions testdata/extensions/cuda-requirement_v1_1.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.1
class: CommandLineTool
$namespaces:
cwltool: "http://commonwl.org/cwltool#"
requirements:
cwltool:CUDARequirement:
cudaVersionMin: "1.0"
cudaComputeCapability: "1.0"
cudaDeviceCountMin: $(inputs.gpus)
inputs:
gpus:
type: int
default: 1
outputs: []
baseCommand: "nvidia-smi"
16 changes: 16 additions & 0 deletions testdata/extensions/cuda-requirement_v1_2.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.2
class: CommandLineTool
$namespaces:
cwltool: "http://commonwl.org/cwltool#"
requirements:
cwltool:CUDARequirement:
cudaVersionMin: "1.0"
cudaComputeCapability: "1.0"
cudaDeviceCountMin: $(inputs.gpus)
inputs:
gpus:
type: int
default: 1
outputs: []
baseCommand: "nvidia-smi"
21 changes: 21 additions & 0 deletions testdata/extensions/inplace-update-requirement_v1_0.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env cwl-runner
class: CommandLineTool
cwlVersion: v1.0
$namespaces:
cwltool: "http://commonwl.org/cwltool#"
requirements:
cwltool:InplaceUpdateRequirement:
inplaceUpdate: true
inputs:
r: File
script:
type: File
default:
class: File
location: updateval.py
outputs:
out:
type: File
outputBinding:
glob: $(inputs.r.basename)
arguments: [python, $(inputs.script), $(inputs.r.basename)]
13 changes: 13 additions & 0 deletions testdata/extensions/load-listing-requirement_v1_0.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env cwl-runner
class: CommandLineTool
cwlVersion: v1.0
$namespaces:
cwltool: http://commonwl.org/cwltool#
requirements:
cwltool:LoadListingRequirement:
loadListing: shallow_listing
inputs:
d: Directory
outputs: []
arguments:
[echo, "$(inputs.d.listing[0].listing[0])"]
14 changes: 14 additions & 0 deletions testdata/extensions/mpi-requirement_v1_0.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env cwl-runner
class: CommandLineTool
cwlVersion: v1.0
$namespaces:
cwltool: "http://commonwl.org/cwltool#"

baseCommand: env
requirements:
cwltool:MPIRequirement:
processes: 1
inputs: {}
outputs:
environment:
type: stdout
13 changes: 13 additions & 0 deletions testdata/extensions/mpi-requirement_v1_1.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env cwl-runner
class: CommandLineTool
cwlVersion: v1.1
$namespaces:
cwltool: "http://commonwl.org/cwltool#"
baseCommand: env
requirements:
cwltool:MPIRequirement:
processes: 1
inputs: {}
outputs:
environment:
type: stdout
13 changes: 13 additions & 0 deletions testdata/extensions/mpi-requirement_v1_2.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env cwl-runner
class: CommandLineTool
cwlVersion: v1.2
$namespaces:
cwltool: "http://commonwl.org/cwltool#"
baseCommand: env
requirements:
cwltool:MPIRequirement:
processes: 1
inputs: {}
outputs:
environment:
type: stdout
16 changes: 16 additions & 0 deletions testdata/extensions/network-access_v1_0.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env cwl-runner
class: CommandLineTool
cwlVersion: v1.0
$namespaces:
cwltool: "http://commonwl.org/cwltool#"
requirements:
cwltool:NetworkAccess:
networkAccess: true
inputs: []
outputs: []
baseCommand: python
arguments:
- "-c"
- valueFrom: |
import urllib.request
assert(urllib.request.urlopen("http://commonwl.org").code == 200)
32 changes: 32 additions & 0 deletions testdata/extensions/process-generator_v1_0.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
$namespaces:
cwltool: "http://commonwl.org/cwltool#"
class: cwltool:ProcessGenerator
inputs:
script: string
dir: Directory
outputs: {}
run:
class: CommandLineTool
inputs:
script: string
dir: Directory
outputs:
runProcess:
type: File
outputBinding:
glob: main.cwl
requirements:
InlineJavascriptRequirement: {}
LoadListingRequirement:
loadListing: shallow_listing
InitialWorkDirRequirement:
listing: |
${
var v = inputs.dir.listing;
v.push({entryname: "inp.py", entry: inputs.script});
return v;
}
arguments: [python3, inp.py]
stdout: main.cwl
32 changes: 32 additions & 0 deletions testdata/extensions/process-generator_v1_1.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.1
$namespaces:
cwltool: "http://commonwl.org/cwltool#"
class: cwltool:ProcessGenerator
inputs:
script: string
dir: Directory
outputs: {}
run:
class: CommandLineTool
inputs:
script: string
dir: Directory
outputs:
runProcess:
type: File
outputBinding:
glob: main.cwl
requirements:
InlineJavascriptRequirement: {}
LoadListingRequirement:
loadListing: shallow_listing
InitialWorkDirRequirement:
listing: |
${
var v = inputs.dir.listing;
v.push({entryname: "inp.py", entry: inputs.script});
return v;
}
arguments: [python3, inp.py]
stdout: main.cwl
32 changes: 32 additions & 0 deletions testdata/extensions/process-generator_v1_2.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.2
$namespaces:
cwltool: "http://commonwl.org/cwltool#"
class: cwltool:ProcessGenerator
inputs:
script: string
dir: Directory
outputs: {}
run:
class: CommandLineTool
inputs:
script: string
dir: Directory
outputs:
runProcess:
type: File
outputBinding:
glob: main.cwl
requirements:
InlineJavascriptRequirement: {}
LoadListingRequirement:
loadListing: shallow_listing
InitialWorkDirRequirement:
listing: |
${
var v = inputs.dir.listing;
v.push({entryname: "inp.py", entry: inputs.script});
return v;
}
arguments: [python3, inp.py]
stdout: main.cwl
13 changes: 13 additions & 0 deletions testdata/extensions/secrets_v1_0.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
$namespaces:
cwltool: http://commonwl.org/cwltool#
requirements:
cwltool:Secrets:
secrets: [pw]
inputs:
pw: string
outputs:
out: stdout
arguments: [cat, example.conf]
13 changes: 13 additions & 0 deletions testdata/extensions/secrets_v1_1.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.1
class: CommandLineTool
$namespaces:
cwltool: http://commonwl.org/cwltool#
requirements:
cwltool:Secrets:
secrets: [pw]
inputs:
pw: string
outputs:
out: stdout
arguments: [cat, example.conf]
13 changes: 13 additions & 0 deletions testdata/extensions/secrets_v1_2.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.2
class: CommandLineTool
$namespaces:
cwltool: http://commonwl.org/cwltool#
requirements:
cwltool:Secrets:
secrets: [pw]
inputs:
pw: string
outputs:
out: stdout
arguments: [cat, example.conf]
15 changes: 15 additions & 0 deletions testdata/extensions/shm-size_v1_0.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env cwl-runner
class: CommandLineTool
cwlVersion: v1.0
$namespaces:
cwltool: "http://commonwl.org/cwltool#"
requirements:
cwltool:ShmSize:
shmSize: 128m
inputs: []
outputs:
output:
type: stdout
baseCommand: echo
stdout: shm-size.txt
arguments: [ $(runtime) ]
15 changes: 15 additions & 0 deletions testdata/extensions/shm-size_v1_1.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env cwl-runner
class: CommandLineTool
cwlVersion: v1.1
$namespaces:
cwltool: "http://commonwl.org/cwltool#"
requirements:
cwltool:ShmSize:
shmSize: 128m
inputs: []
outputs:
output:
type: stdout
baseCommand: echo
stdout: shm-size.txt
arguments: [ $(runtime) ]
Loading

0 comments on commit 1f9362d

Please sign in to comment.