Skip to content

Commit 7746701

Browse files
committed
Merge branch 'upstream-main' into on-error-abort
2 parents 9b86d6e + 7b8f174 commit 7746701

File tree

10 files changed

+108
-13
lines changed

10 files changed

+108
-13
lines changed

.github/workflows/ci-tests.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@ jobs:
8181

8282
- name: Upload coverage to Codecov
8383
if: ${{ matrix.step == 'unit' }}
84-
uses: codecov/codecov-action@v3
84+
uses: codecov/codecov-action@v4
8585
with:
86-
fail_ci_if_error: false
87-
token: ${{ secrets.CODECOV_TOKEN }}
86+
fail_ci_if_error: true
87+
env:
88+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
8889

8990
tox-style:
9091
name: Linters
@@ -213,10 +214,11 @@ jobs:
213214
path: |
214215
**/cwltool_conf*.xml
215216
- name: Upload coverage to Codecov
216-
uses: codecov/codecov-action@v3
217+
uses: codecov/codecov-action@v4
217218
with:
218-
fail_ci_if_error: false
219-
token: ${{ secrets.CODECOV_TOKEN }}
219+
fail_ci_if_error: true
220+
env:
221+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
220222
release_test:
221223
name: cwltool release test
222224
runs-on: ubuntu-22.04
@@ -297,7 +299,8 @@ jobs:
297299
- name: Test with tox
298300
run: tox
299301
- name: Upload coverage to Codecov
300-
uses: codecov/codecov-action@v3
302+
uses: codecov/codecov-action@v4
301303
with:
302-
fail_ci_if_error: false
303-
token: ${{ secrets.CODECOV_TOKEN }}
304+
fail_ci_if_error: true
305+
env:
306+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

cwltool/cwlprov/provenance_profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ def declare_artefact(self, value: Any) -> ProvEntity:
498498
self.research_object.add_uri(entity.identifier.uri)
499499
return entity
500500

501-
if isinstance(value, (str, str)):
501+
if isinstance(value, str):
502502
(entity, _) = self.declare_string(value)
503503
return entity
504504

cwltool/docker.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,10 @@ def create_runtime(
429429
"assurance.",
430430
self.name,
431431
)
432-
432+
shm_size_od, shm_bool = self.builder.get_requirement("http://commonwl.org/cwltool#ShmSize")
433+
if shm_bool:
434+
shm_size = cast(CWLObjectType, shm_size_od)["shmSize"]
435+
runtime.append(f"--shm-size={shm_size}")
433436
return runtime, cidfile_path
434437

435438

cwltool/extensions-v1.1.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,21 @@ $graph:
120120
doc: |
121121
Maximum number of GPU devices to request. If not specified,
122122
same as `cudaDeviceCountMin`.
123+
- name: ShmSize
124+
type: record
125+
extends: cwl:ProcessRequirement
126+
inVocab: false
127+
fields:
128+
class:
129+
type: string
130+
doc: 'cwltool:ShmSize'
131+
jsonldPredicate:
132+
"_id": "@type"
133+
"_type": "@vocab"
134+
shmSize:
135+
type: string
136+
doc: |
137+
Size of /dev/shm. The format is `<number><unit>`. <number> must be greater
138+
than 0. Unit is optional and can be `b` (bytes), `k` (kilobytes), `m`
139+
(megabytes), or `g` (gigabytes). If you omit the unit, the default is
140+
bytes. If you omit the size entirely, the value is `64m`."

cwltool/extensions-v1.2.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,21 @@ $graph:
240240
- Specify the desired method of dealing with loop outputs
241241
- Default. Propagates only the last computed element to the subsequent steps when the loop terminates.
242242
- Propagates a single array with all output values to the subsequent steps when the loop terminates.
243-
243+
- name: ShmSize
244+
type: record
245+
extends: cwl:ProcessRequirement
246+
inVocab: false
247+
fields:
248+
class:
249+
type: string
250+
doc: 'cwltool:ShmSize'
251+
jsonldPredicate:
252+
"_id": "@type"
253+
"_type": "@vocab"
254+
shmSize:
255+
type: string
256+
doc: |
257+
Size of /dev/shm. The format is `<number><unit>`. <number> must be greater
258+
than 0. Unit is optional and can be `b` (bytes), `k` (kilobytes), `m`
259+
(megabytes), or `g` (gigabytes). If you omit the unit, the default is
260+
bytes. If you omit the size entirely, the value is `64m`."

cwltool/extensions.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
$base: http://commonwl.org/cwltool#
22
$namespaces:
33
cwl: "https://w3id.org/cwl/cwl#"
4+
cwltool: "http://commonwl.org/cwltool#"
45
$graph:
56
- $import: https://w3id.org/cwl/CommonWorkflowLanguage.yml
67

@@ -229,3 +230,21 @@ $graph:
229230
doc: |
230231
Maximum number of GPU devices to request. If not specified,
231232
same as `cudaDeviceCountMin`.
233+
- name: ShmSize
234+
type: record
235+
extends: cwl:ProcessRequirement
236+
inVocab: false
237+
fields:
238+
class:
239+
type: string
240+
doc: 'cwltool:ShmSize'
241+
jsonldPredicate:
242+
"_id": "@type"
243+
"_type": "@vocab"
244+
shmSize:
245+
type: string
246+
doc: |
247+
Size of /dev/shm. The format is `<number><unit>`. <number> must be greater
248+
than 0. Unit is optional and can be `b` (bytes), `k` (kilobytes), `m`
249+
(megabytes), or `g` (gigabytes). If you omit the unit, the default is
250+
bytes. If you omit the size entirely, the value is `64m`."

cwltool/process.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def filter(self, record: logging.LogRecord) -> bool:
121121
"http://commonwl.org/cwltool#LoadListingRequirement",
122122
"http://commonwl.org/cwltool#InplaceUpdateRequirement",
123123
"http://commonwl.org/cwltool#CUDARequirement",
124+
"http://commonwl.org/cwltool#ShmSize",
124125
]
125126

126127
cwl_files = (

cwltool/singularity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def add_writable_file_volume(
390390
if self.inplace_update:
391391
try:
392392
os.link(os.path.realpath(volume.resolved), host_outdir_tgt)
393-
except os.error:
393+
except OSError:
394394
shutil.copy(volume.resolved, host_outdir_tgt)
395395
else:
396396
shutil.copy(volume.resolved, host_outdir_tgt)

tests/test_docker.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,20 @@ def test_singularity_required_missing_secfile(
264264
"tests/secondary-files-required-missing-container.cwl:16:5: Missing required secondary file"
265265
)
266266
assert "file.ext3" in stderr
267+
268+
269+
@needs_docker
270+
def test_docker_shm_size(tmp_path: Path) -> None:
271+
result_code, stdout, stderr = get_main_output(
272+
[
273+
"--enable-ext",
274+
"--default-container",
275+
"docker.io/debian:stable-slim",
276+
"--outdir",
277+
str(tmp_path),
278+
get_data("tests/wf/shm_size.cwl"),
279+
]
280+
)
281+
stderr = re.sub(r"\s\s+", " ", stderr)
282+
assert result_code == 0
283+
assert "--shm-size=128m" in stderr

tests/wf/shm_size.cwl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env cwl-runner
2+
class: CommandLineTool
3+
cwlVersion: v1.2
4+
requirements:
5+
cwltool:ShmSize:
6+
shmSize: 128m
7+
inputs: []
8+
9+
outputs:
10+
output:
11+
type: stdout
12+
13+
baseCommand: echo
14+
15+
stdout: shm-size.txt
16+
17+
arguments: [ $(runtime) ]

0 commit comments

Comments
 (0)