Skip to content

Commit c0b949e

Browse files
authored
Merge pull request #44 from common-workflow-language/resource-floats
Resource floats
2 parents 86b1420 + 40fa8ca commit c0b949e

File tree

3 files changed

+96
-21
lines changed

3 files changed

+96
-21
lines changed

CommandLineTool.yml

Lines changed: 57 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ $graph:
5353
5454
* `coresMin` and `coresMax` of
5555
[ResourceRequirement](#ResourceRequirement) may now request fractional CPUs.
56+
* `ramMin`, `ramMax`, `tmpdirMin`, `tmpdirMax`, `outdirMin`, and `outdirMax` of
57+
[ResourceRequirement](#ResourceRequirement) now accept floating point values.
5658
* (CommandLineTool)[#CommandLineTool] can now express `intent`
5759
with an identifier for the type of computational operation.
5860
* Added conformance tests for order of operations evaluating `secondaryFiles` on input
@@ -1100,15 +1102,20 @@ $graph:
11001102
doc: |
11011103
Specify basic hardware resource requirements.
11021104
1103-
"min" is the minimum amount of a resource that must be reserved to schedule
1104-
a job. If "min" cannot be satisfied, the job should not be run.
1105+
"min" is the minimum amount of a resource that must be reserved to
1106+
schedule a job. If "min" cannot be satisfied, the job should not
1107+
be run.
11051108
1106-
"max" is the maximum amount of a resource that the job shall be permitted
1107-
to use. If a node has sufficient resources, multiple jobs may be scheduled
1108-
on a single node provided each job's "max" resource requirements are
1109-
met. If a job attempts to exceed its "max" resource allocation, an
1110-
implementation may deny additional resources, which may result in job
1111-
failure.
1109+
"max" is the maximum amount of a resource that the job shall be
1110+
allocated. If a node has sufficient resources, multiple jobs may
1111+
be scheduled on a single node provided each job's "max" resource
1112+
requirements are met. If a job attempts to exceed its resource
1113+
allocation, an implementation may deny additional resources, which
1114+
may result in job failure.
1115+
1116+
If both "min" and "max" are specified, an implementation may
1117+
choose to allocate any amount between "min" and "max", with the
1118+
actual allocation provided in the `runtime` object.
11121119
11131120
If "min" is specified but "max" is not, then "max" == "min"
11141121
If "max" is specified by "min" is not, then "min" == "max".
@@ -1163,28 +1170,58 @@ $graph:
11631170
See `coresMin` for discussion about fractional CPU requests.
11641171
11651172
- name: ramMin
1166-
type: ["null", long, Expression]
1167-
doc: Minimum reserved RAM in mebibytes (2**20) (default is 256)
1173+
type: ["null", long, float, Expression]
1174+
doc: |
1175+
Minimum reserved RAM in mebibytes (2**20) (default is 256)
1176+
1177+
May be a fractional value. If so, the actual RAM request must
1178+
be rounded up to the next whole number. The reported amount of
1179+
RAM reserved for the process, which is available to
1180+
expressions on the CommandLineTool as `runtime.ram`, must be a
1181+
non-zero integer.
11681182
11691183
- name: ramMax
1170-
type: ["null", long, Expression]
1171-
doc: Maximum reserved RAM in mebibytes (2**20)
1184+
type: ["null", long, float, Expression]
1185+
doc: |
1186+
Maximum reserved RAM in mebibytes (2**20)
1187+
1188+
See `ramMin` for discussion about fractional RAM requests.
11721189
11731190
- name: tmpdirMin
1174-
type: ["null", long, Expression]
1175-
doc: Minimum reserved filesystem based storage for the designated temporary directory, in mebibytes (2**20) (default is 1024)
1191+
type: ["null", long, float, Expression]
1192+
doc: |
1193+
Minimum reserved filesystem based storage for the designated temporary directory, in mebibytes (2**20) (default is 1024)
1194+
1195+
May be a fractional value. If so, the actual storage request
1196+
must be rounded up to the next whole number. The reported
1197+
amount of storage reserved for the process, which is available
1198+
to expressions on the CommandLineTool as `runtime.tmpdirSize`,
1199+
must be a non-zero integer.
11761200
11771201
- name: tmpdirMax
1178-
type: ["null", long, Expression]
1179-
doc: Maximum reserved filesystem based storage for the designated temporary directory, in mebibytes (2**20)
1202+
type: ["null", long, float, Expression]
1203+
doc: |
1204+
Maximum reserved filesystem based storage for the designated temporary directory, in mebibytes (2**20)
1205+
1206+
See `tmpdirMin` for discussion about fractional storage requests.
11801207
11811208
- name: outdirMin
1182-
type: ["null", long, Expression]
1183-
doc: Minimum reserved filesystem based storage for the designated output directory, in mebibytes (2**20) (default is 1024)
1209+
type: ["null", long, float, Expression]
1210+
doc: |
1211+
Minimum reserved filesystem based storage for the designated output directory, in mebibytes (2**20) (default is 1024)
1212+
1213+
May be a fractional value. If so, the actual storage request
1214+
must be rounded up to the next whole number. The reported
1215+
amount of storage reserved for the process, which is available
1216+
to expressions on the CommandLineTool as `runtime.outdirSize`,
1217+
must be a non-zero integer.
11841218
11851219
- name: outdirMax
1186-
type: ["null", long, Expression]
1187-
doc: Maximum reserved filesystem based storage for the designated output directory, in mebibytes (2**20)
1220+
type: ["null", long, float, Expression]
1221+
doc: |
1222+
Maximum reserved filesystem based storage for the designated output directory, in mebibytes (2**20)
1223+
1224+
See `outdirMin` for discussion about fractional storage requests.
11881225
11891226
11901227
- type: record

conformance_tests.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3340,7 +3340,22 @@
33403340
"checksum": "sha1$7448d8798a4380162d4b56f9b452e2f6f9e24e7a"
33413341
}
33423342
tags: [ resource, command_line_tool ]
3343-
id: 254
3343+
id: 255
3344+
3345+
- job: tests/empty.json
3346+
tool: tests/storage_float.cwl
3347+
label: storage_float
3348+
doc: Test float value for ram/tmpdir/outdir Min(Max) is rounded up
3349+
output:
3350+
output: {
3351+
"location": "values.txt",
3352+
"basename": "values.txt",
3353+
"class": "File",
3354+
"checksum": "sha1$c73f68407c144c5336a6c14e7ec79ee470231bd7",
3355+
"size": 12
3356+
}
3357+
tags: [ resource, command_line_tool ]
3358+
id: 256
33443359

33453360
- $import: tests/string-interpolation/test-index.yaml
33463361

tests/storage_float.cwl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env cwl-runner
2+
class: CommandLineTool
3+
cwlVersion: v1.2.0-dev4
4+
5+
requirements:
6+
ResourceRequirement:
7+
ramMin: 254.1
8+
ramMax: 254.9
9+
tmpdirMin: 255.1
10+
tmpdirMax: 255.9
11+
outdirMin: 256.1
12+
outdirMax: 256.9
13+
14+
inputs: []
15+
16+
outputs:
17+
output: stdout
18+
19+
baseCommand: echo
20+
21+
stdout: values.txt
22+
23+
arguments: [ $(runtime.ram), $(runtime.tmpdirSize), $(runtime.outdirSize) ]

0 commit comments

Comments
 (0)