Skip to content

Commit 81b7095

Browse files
author
Peter Amstutz
committed
Merge branch 'resource-requirement'
2 parents 8702a1c + 21aa2fe commit 81b7095

File tree

3 files changed

+116
-30
lines changed

3 files changed

+116
-30
lines changed

draft-3/cwl-avro.yml

Lines changed: 111 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,13 @@
361361
documented for specific fields elsewhere in this specification. If
362362
a contextual value of 'self' is not documented for a field, it
363363
must be 'null'.
364-
* `runtime`: An object containing configuration specific to the Process
365-
type. Values include `tmpdir`, `outdir`, and values associated with
366-
[ResourceRequirement](#resourcerequirement).
367-
Other fields under `runtime` are listed elsewhere in this document.
364+
* `runtime`: An object containing configuration details. Specific to the
365+
[Process](#process) type. An implementation may provide may provide
366+
opaque strings for any or all fields of `runtime`. These must be
367+
filled in by the platform after processing the Tool but before actual
368+
execution. Parameter references and expressions may only use the
369+
literal string value of the field and must not perform computation on
370+
the contents.
368371
369372
If the value of a field has no leading or trailing non-whitespace
370373
characters around a parameter reference, the effective value of the field
@@ -1429,40 +1432,65 @@
14291432
All files listed in the input object must be made available in the runtime
14301433
environment. The implementation may use a shared or distributed file
14311434
system or transfer files via explicit download. Implementations may choose
1432-
not to provide access to files not explicitly specified by the input object
1435+
not to provide access to files not explicitly specified in the input object
14331436
or process requirements.
14341437
14351438
Output files produced by tool execution must be written to the **designated
1436-
output directory**.
1437-
1438-
The initial current working directory when executing the tool must be the
1439-
designated output directory.
1440-
1441-
When executing the tool, the child process must not inherit environment
1442-
variables from the parent process. The tool must execute in a new, empty
1443-
environment, containing only environment variables defined by
1444-
[EnvVarRequirement](#envvarrequirement), the default environment of the
1445-
Docker container specified in [DockerRequirement](#dockerrequirement) (if
1446-
applicable), and `TMPDIR`.
1447-
1448-
The `TMPDIR` environment variable must be set in the runtime environment to
1449-
the **designated temporary directory**. Any files written to the
1450-
designated temporary directory may be deleted by the workflow platform when
1451-
the tool invocation is complete.
1439+
output directory**. The initial current working directory when executing
1440+
the tool must be the designated output directory.
1441+
1442+
Files may also be written to the **designated temporary directory**. Any
1443+
files written to the designated temporary directory may be deleted by the
1444+
workflow platform immediately after the tool terminates.
1445+
1446+
When executing the tool, the tool must execute in a new, empty environment
1447+
with only the environment variables described below; the child process must
1448+
not inherit environment variables from the parent process except where
1449+
specified or at user option.
1450+
1451+
* `HOME` must be set to the designated output directory.
1452+
* `TMPDIR` must be set to the designated temporary directory.
1453+
when the tool invocation and output collection is complete.
1454+
* `PATH` may be inherited from the parent process, except when run in a
1455+
container that provides its own `PATH`.
1456+
* Variables defined by [EnvVarRequirement](#envvarrequirement)
1457+
* The default environment of the container, such as when using
1458+
[DockerRequirement](#dockerrequirement)
14521459
14531460
An implementation may forbid the tool from writing to any location in the
14541461
runtime environment file system other than the designated temporary
14551462
directory and designated output directory. An implementation may provide
1456-
read-only input files, and disallow in-place update of input files.
1463+
read-only input files, and disallow in-place update of input files. The
1464+
designated temporary directory and designated output directory may reside
1465+
on different mount points on different file systems.
1466+
1467+
The `runtime` section available in [parameter references](#parameterreferences)
1468+
and [expressions](#expressions) contains the following fields. As noted
1469+
earlier, an implementation may perform deferred resolution of runtime fields by providing
1470+
opaque strings for any or all of the following fields; parameter references
1471+
and expressions may only use the literal string value of the field and must
1472+
not perform computation on the contents.
1473+
1474+
* `runtime.outdir`: an absolute path to the designated output directory
1475+
* `runtime.tmpdir`: an absolute path to the designated temporary directory
1476+
* `runtime.cores`: number of CPU cores reserved for the tool process
1477+
* `runtime.ram`: amount of RAM in mebibytes (2**20) reserved for the tool process
1478+
* `runtime.outdirSize`: reserved storage space available in the designated output directory
1479+
* `runtime.tmpdirSize`: reserved storage space available in the designated temporary directory
1480+
1481+
See [ResourceRequirement](#resourcerequirement) for details on how to
1482+
describe the hardware resources required by a tool.
14571483
14581484
The standard input stream and standard output stream may be redirected as
14591485
described in the `stdin` and `stdout` fields.
14601486
14611487
## Extensions
14621488
14631489
[DockerRequirement](#dockerrequirement),
1464-
[CreateFileRequirement](#createfilerequirement), and
1465-
[EnvVarRequirement](#envvarrequirement) are available as standard
1490+
[CreateFileRequirement](#createfilerequirement),
1491+
[EnvVarRequirement](#envvarrequirement),
1492+
[ShellCommandRequirement](#shellcommandrequirement), and
1493+
[ResourceRequirement](#resourcerequirement) are available as standard
14661494
extensions to core command line tool semantics for defining the runtime
14671495
environment.
14681496
@@ -2083,3 +2111,62 @@
20832111
contains `shellQuote: false`. If `shellQuote: false` is specified, the
20842112
argument is joined into the command string without quoting, which allows
20852113
the use of shell metacharacters such as `|` for pipes.
2114+
2115+
2116+
- type: record
2117+
name: ResourceRequirement
2118+
extends: "#ProcessRequirement"
2119+
doc: |
2120+
Specify basic hardware resource requirements.
2121+
2122+
"min" is the minimum amount of a resource that must be reserved to schedule
2123+
a job. If "min" cannot be satisfied, the job should not be run.
2124+
2125+
"max" is the maximum amount of a resource that the job shall be permitted
2126+
to use. If a node has sufficient resources, multiple jobs may be scheduled
2127+
on a single node provided each job's "max" resource requirements are
2128+
met. If a job attempts to exceed its "max" resource allocation, an
2129+
implementation may deny additional resources, which may result in job
2130+
failure.
2131+
2132+
If "min" is specified but "max" is not, then "max" == "min"
2133+
If "max" is specified by "min" is not, then "min" == "max".
2134+
2135+
It is an error if max < min.
2136+
2137+
It is an error if the value of any of these fields is negative.
2138+
2139+
If neither "min" nor "max" is specified for a resource, an implementation may provide a default.
2140+
2141+
fields:
2142+
- name: coresMin
2143+
type: ["null", long, string, "#Expression"]
2144+
doc: Minimum reserved number of CPU cores
2145+
2146+
- name: coresMax
2147+
type: ["null", int, string, "#Expression"]
2148+
doc: Maximum reserved number of CPU cores
2149+
2150+
- name: ramMin
2151+
type: ["null", long, string, "#Expression"]
2152+
doc: Minimum reserved RAM in mebibytes (2**20)
2153+
2154+
- name: ramMax
2155+
type: ["null", long, string, "#Expression"]
2156+
doc: Maximum reserved RAM in mebibytes (2**20)
2157+
2158+
- name: tmpdirMin
2159+
type: ["null", long, string, "#Expression"]
2160+
doc: Minimum reserved filesystem based storage for the designated temporary directory, in mebibytes (2**20)
2161+
2162+
- name: tmpdirMax
2163+
type: ["null", long, string, "#Expression"]
2164+
doc: Maximum reserved filesystem based storage for the designated temporary directory, in mebibytes (2**20)
2165+
2166+
- name: outdirMin
2167+
type: ["null", long, string, "#Expression"]
2168+
doc: Minimum reserved filesystem based storage for the designated output directory, in mebibytes (2**20)
2169+
2170+
- name: outdirMax
2171+
type: ["null", long, string, "#Expression"]
2172+
doc: Maximum reserved filesystem based storage for the designated output directory, in mebibytes (2**20)

draft-3/draft-3/bwa-mem-job.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,5 @@
2121
3,
2222
4
2323
],
24-
"minimum_seed_length": 3,
25-
"allocatedResources": {
26-
"cores": 4,
27-
"mem": 5000
28-
}
24+
"minimum_seed_length": 3
2925
}

draft-3/draft-3/bwa-mem-tool.cwl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ hints:
99
dockerPull: images.sbgenomics.com/rabix/bwa
1010
dockerImageId: 9d3b9b0359cf
1111

12+
- class: ResourceRequirement
13+
coresMin: 4
14+
1215
inputs:
1316
- id: reference
1417
type: File
@@ -39,7 +42,7 @@ outputs:
3942
baseCommand: [bwa, mem]
4043

4144
arguments:
42-
- valueFrom: $(inputs.allocatedResources.cores)
45+
- valueFrom: $(runtime.cores)
4346
position: 1
4447
prefix: -t
4548

0 commit comments

Comments
 (0)