Skip to content

Commit 63f539b

Browse files
authored
Inplace input v1.1 (#1035)
* Update embedded v1.1.0-dev1 spec * Support unprefixed InplaceUpdateRequirement in v1.1
1 parent 4bf61c8 commit 63f539b

File tree

253 files changed

+332
-60456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

253 files changed

+332
-60456
lines changed

cwltool/command_line_tool.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,8 @@ def rm_pending_output_callback(output_callbacks, jobcachepending,
516516
j.stagedir = builder.stagedir
517517

518518
inplaceUpdateReq, _ = self.get_requirement("http://commonwl.org/cwltool#InplaceUpdateRequirement")
519+
if not inplaceUpdateReq and self.metadata["cwlVersion"] == "v1.1.0-dev1":
520+
inplaceUpdateReq, _ = self.get_requirement("InplaceUpdateRequirement")
519521

520522
if inplaceUpdateReq is not None:
521523
j.inplace_update = inplaceUpdateReq["inplaceUpdate"]

cwltool/process.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def filter(self, record):
8282
"TimeLimit",
8383
"WorkReuse",
8484
"NetworkAccess",
85+
"InplaceUpdateRequirement",
8586
"http://commonwl.org/cwltool#TimeLimit",
8687
"http://commonwl.org/cwltool#WorkReuse",
8788
"http://commonwl.org/cwltool#NetworkAccess",

cwltool/schemas/v1.1.0-dev1/CommandLineTool.yml

Lines changed: 91 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ $graph:
3636
- {$include: intro.md}
3737

3838
- |
39-
## Introduction to CWL Command Line Tool standard v1.1.0-dev1
39+
## Introduction to the CWL Command Line Tool standard v1.1.0-dev1
4040
4141
This specification represents the latest development release from the
4242
CWL group. Since the v1.0 release, v1.1 introduces the
@@ -61,13 +61,17 @@ $graph:
6161
disappeared in `v1.0`)
6262
* Any `doc` field may be an array of strings in addition to the
6363
previously allowed single string.
64-
* Addition of `stdin` type shortcut for `CommandInputParameter`.
64+
* Addition of `stdin` type shortcut for
65+
[`CommandInputParameter`](#CommandInputParameter).
6566
* Clarify that the designated output directory should be empty
6667
except for files or directories specified using
6768
[InitialWorkDirRequirement](#InitialWorkDirRequirement).
6869
* Clarify semantics of `shellQuote`
6970
* Expressions are now allowed to evaluate to `null` or `Dirent` in
7071
[InitialWorkDirRequirement.listing](#InitialWorkDirRequirement).
72+
* [Addition](#Requirements_and_hints) of `cwl:requirements` field to
73+
input object documents
74+
* Clarify behavior of `glob` for absolute paths and symlinks.
7175
7276
See also the [CWL Workflow Description, v1.1.0-dev1 changelog](Workflow.html#Changelog).
7377
@@ -147,10 +151,14 @@ $graph:
147151
- **File**: Add `prefix` and the value of
148152
[`File.path`](#File) to the command line.
149153
154+
- **Directory**: Add `prefix` and the value of
155+
[`Directory.path`](#Directory) to the command line.
156+
150157
- **array**: If `itemSeparator` is specified, add `prefix` and the join
151158
the array into a single string with `itemSeparator` separating the
152159
items. Otherwise first add `prefix`, then recursively process
153160
individual elements.
161+
If the array is empty, it does not add anything to command line.
154162
155163
- **object**: Add `prefix` only, and recursively add object fields for
156164
which `inputBinding` is specified.
@@ -205,7 +213,7 @@ $graph:
205213
this controls whether the value is quoted on the command line (default is true).
206214
Use `shellQuote: false` to inject metacharacters for operations such as pipes.
207215
208-
If `shellQuote` is true or null, the implementation must not
216+
If `shellQuote` is true or not provided, the implementation must not
209217
permit interpretation of any shell metacharacters or directives.
210218
211219
@@ -238,6 +246,37 @@ $graph:
238246
return a string or an array of strings, which will then be evaluated as
239247
one or more glob patterns. Must only match and return files which
240248
actually exist.
249+
250+
If the value of glob is a relative path pattern (does not
251+
begin with a slash '/') then it is resolved relative to the
252+
output directory. If the value of the glob is an absolute
253+
path pattern (it does begin with a slash '/') then it must
254+
refer to a path within the output directory. It is an error
255+
if any glob resolves to a path outside the output directory.
256+
Specifically this means globs with relative paths containing
257+
'..' or absolute paths that refer outside the output directory
258+
are illegal.
259+
260+
A glob may match a path within the output directory which is
261+
actually a symlink to another file. In this case, the
262+
expected behavior is for the resulting File object to take the
263+
`basename` (and corresponding `nameroot` and `nameext`) of the
264+
symlink. The `location` of the File is implementation
265+
dependent, but logically the File should have the same content
266+
as the symlink target. Platforms may stage output files to
267+
cloud storage that lack the concept of a symlink. In
268+
this case file content may be duplicated, or (to avoid
269+
duplication) the File `location` may refer to the symlink
270+
target.
271+
272+
It is an error if a symlink in the output directory (or any
273+
symlink in a chain of links) refers to any file or directory
274+
that is not under an input or output directory.
275+
276+
Implementations may shut down a container before globbing
277+
output, so globs and expressions must not assume access to the
278+
container filesystem except for declared input and output.
279+
241280
- name: outputEval
242281
type:
243282
- "null"
@@ -670,9 +709,11 @@ $graph:
670709
the appropriate Docker image and tool command line.
671710
672711
The workflow platform may provide input files and the designated output
673-
directory through the use of volume bind mounts. The platform may rewrite
712+
directory through the use of volume bind mounts. The platform should rewrite
674713
file paths in the input object to correspond to the Docker bind mounted
675-
locations.
714+
locations. That is, the platform should rewrite values in the parameter context
715+
such as `runtime.outdir`, `runtime.tmpdir` and others to be valid paths
716+
within the container.
676717
677718
When running a tool contained in Docker, the workflow platform must not
678719
assume anything about the contents of the Docker container, such as the
@@ -1078,3 +1119,48 @@ $graph:
10781119
"_type": "@vocab"
10791120
- name: networkAccess
10801121
type: [boolean, string, Expression]
1122+
1123+
- name: InplaceUpdateRequirement
1124+
type: record
1125+
extends: cwl:ProcessRequirement
1126+
doc: |
1127+
1128+
If `inplaceUpdate` is true, then an implementation supporting this
1129+
feature may permit tools to directly update files with `writable:
1130+
true` in InitialWorkDirRequirement. That is, as an optimization,
1131+
files may be destructively modified in place as opposed to copied
1132+
and updated.
1133+
1134+
An implementation must ensure that only one workflow step may
1135+
access a writable file at a time. It is an error if a file which
1136+
is writable by one workflow step file is accessed (for reading or
1137+
writing) by any other workflow step running independently.
1138+
However, a file which has been updated in a previous completed
1139+
step may be used as input to multiple steps, provided it is
1140+
read-only in every step.
1141+
1142+
Workflow steps which modify a file must produce the modified file
1143+
as output. Downstream steps which futher process the file must
1144+
use the output of previous steps, and not refer to a common input
1145+
(this is necessary for both ordering and correctness).
1146+
1147+
Workflow authors should provide this in the `hints` section. The
1148+
intent of this feature is that workflows produce the same results
1149+
whether or not InplaceUpdateRequirement is supported by the
1150+
implementation, and this feature is primarily available as an
1151+
optimization for particular environments.
1152+
1153+
Users and implementers should be aware that workflows that
1154+
destructively modify inputs may not be repeatable or reproducible.
1155+
In particular, enabling this feature implies that WorkReuse should
1156+
not be enabled.
1157+
1158+
fields:
1159+
class:
1160+
type: string
1161+
doc: "Always 'InplaceUpdateRequirement'"
1162+
jsonldPredicate:
1163+
"_id": "@type"
1164+
"_type": "@vocab"
1165+
inplaceUpdate:
1166+
type: boolean

cwltool/schemas/v1.1.0-dev1/Process.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ $graph:
293293
The `location` property of a Directory is a URI that uniquely identifies
294294
the directory. Implementations must support the file:// URI scheme and may
295295
support other schemes such as http://. Alternately to `location`,
296-
implementations must also accept the `path` property on Direcotry, which
296+
implementations must also accept the `path` property on Directory, which
297297
must be a filesystem path available on the same host as the CWL runner (for
298298
inputs) or the runtime environment of a command line tool execution (for
299299
command line tool outputs).

cwltool/schemas/v1.1.0-dev1/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Common Workflow Language Specifications, v1.1.0-dev1
22

3+
<!-- remove this before v1.1 is final! -->
4+
WARNING, this is a draft and in progress! Development of CWL v1.1 is coordinated at https://github.com/common-workflow-language/common-workflow-language/milestone/6
5+
36
The CWL specifications are divided up into several documents.
47

58
The [User Guide](http://www.commonwl.org/user_guide/) provides a gentle
@@ -17,3 +20,52 @@ The
1720
[Semantic Annotations for Linked Avro Data (SALAD) Specification](SchemaSalad.html)
1821
specifies the preprocessing steps that must be applied when loading CWL
1922
documents and the schema language used to write the above specifications.
23+
24+
Also available are inheritance graphs (as SVG images) for the [Schema Salad object model](salad.svg) and the [CWL object model](cwl.svg).
25+
26+
# Running the CWL conformance tests
27+
28+
1. Install a CWL runner of your choice. The reference runner can be installed as
29+
the default runner by doing:
30+
```
31+
pip install cwlref-runner
32+
```
33+
34+
2. Install the CWL test parser:
35+
36+
```
37+
pip install cwltest
38+
```
39+
You may need to activate a virtualenv first, or do a local install by adding `--user` after `install` above.
40+
41+
3. From within a copy of [this repository](https://github.com/common-workflow-language/cwl-v1.1) (e.g. cwl-v1.1) execute the main test script
42+
```
43+
./run_test.sh
44+
```
45+
46+
If the CWL runner isn't installed as `cwl-runner` then you can specify the name:
47+
48+
```
49+
./run_test.sh RUNNER=cwltool
50+
```
51+
52+
You can also specify additional options that are specific for the particular CWL runner you are using.
53+
For example, with CWL reference runner you can turn on parallel execution mode:
54+
55+
```
56+
./run_test.sh RUNNER=cwltool EXTRA=--parallel
57+
```
58+
59+
This can be combined with launching more than one CWL conformance test at once with `-j`:
60+
61+
```
62+
./run_test.sh -j4 RUNNER=cwltool EXTRA=--parallel
63+
```
64+
65+
66+
For details of options you can pass to the test script, do:
67+
```
68+
./run_test.sh --help
69+
```
70+
71+
The full test suite takes about 10 minutes to run

cwltool/schemas/v1.1.0-dev1/UserGuide.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

cwltool/schemas/v1.1.0-dev1/Workflow.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ $graph:
6565
`WorkflowInputParameter.loadContents` instead.
6666
* The presence of `OutputRecordField.outputBinding` in v1.0 was due to
6767
a technical error and as it makes no semantic sense it was removed.
68-
68+
* `WorkflowStepInput` now has a `label` field
69+
* [Addition](#Requirements_and_hints) of `cwl:requirments` field to
70+
input object documents
6971
7072
See also the [CWL Command Line Tool Description, v1.1.0-dev1 changelog](CommandLineTool.html#Changelog).
7173
@@ -252,7 +254,7 @@ $graph:
252254
253255
- type: record
254256
name: WorkflowStepInput
255-
extends: [Identified, Sink, LoadContents]
257+
extends: [Identified, Sink, LoadContents, Labeled]
256258
docParent: "#WorkflowStep"
257259
doc: |
258260
The input of a workflow step connects an upstream parameter (from the
@@ -321,9 +323,12 @@ $graph:
321323
If `valueFrom` is a parameter reference or expression, it must be
322324
evaluated to yield the actual value to be assiged to the input field.
323325
324-
The `self` value of in the parameter reference or expression must be
325-
the value of the parameter(s) specified in the `source` field, or
326-
null if there is no `source` field.
326+
The `self` value in the parameter reference or expression must be
327+
1. `null` if there is no `source` field
328+
2. the value of the parameter(s) specified in the `source` field when this
329+
workflow input parameter **is not** specified in this workflow step's `scatter` field.
330+
3. an element of the parameter specified in the `source` field when this workflow input
331+
parameter **is** specified in this workflow step's `scatter` field.
327332
328333
The value of `inputs` in the parameter reference or expression must be
329334
the input object to the workflow step after assigning the `source`

cwltool/schemas/v1.1.0-dev1/concepts.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ A **hint** is similar to a requirement; however, it is not an error if an
209209
implementation cannot satisfy all hints. The implementation may report a
210210
warning if a hint cannot be satisfied.
211211

212+
Optionally, implementations may allow requirements to be specified in the input
213+
object document as an array of requirements under the field name
214+
`cwl:requirements`. If implementations allow this, then such requirements
215+
should be combined with any requirements present in the corresponding Process
216+
as if they were specified there.
217+
212218
Requirements are inherited. A requirement specified in a Workflow applies
213219
to all workflow steps; a requirement specified on a workflow step will
214220
apply to the process implementation of that step and any of its substeps.

0 commit comments

Comments
 (0)