Skip to content

Commit 9e7e73d

Browse files
committed
refresh v1.1 schema
1 parent fbf4c06 commit 9e7e73d

File tree

4 files changed

+217
-21
lines changed

4 files changed

+217
-21
lines changed

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

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ $graph:
103103
`Directory` listings should be loaded for use in expressions.
104104
* The position field of the [CommandLineBinding](#CommandLineBinding) can
105105
now be calculated from a CWL Expression.
106+
* The exit code of a CommandLineTool invocation is now
107+
available to expressions in `outputEval` as `runtime.exitCode`
108+
* [Better explain](#map) the `map<…>` notation that has existed since v1.0.
109+
* Fixed schema error where the `type` field inside the `inputs` and
110+
`outputs` field was incorrectly listed as optional.
111+
* For multi-Process CWL documents, if no particular process is named then
112+
the process with the `id` of `#main` is chosen.
106113
107114
See also the [CWL Workflow Description, v1.1.0-dev1 changelog](Workflow.html#Changelog).
108115
@@ -325,13 +332,15 @@ $graph:
325332
- string
326333
- Expression
327334
doc: |
328-
Evaluate an expression to generate the output value. If `glob` was
329-
specified, the value of `self` must be an array containing file objects
330-
that were matched. If no files were matched, `self` must be a zero
331-
length array; if a single file was matched, the value of `self` is an
332-
array of a single element. Additionally, if `loadContents` is `true`,
333-
the File objects must include up to the first 64 KiB of file contents
334-
in the `contents` field.
335+
Evaluate an expression to generate the output value. If
336+
`glob` was specified, the value of `self` must be an array
337+
containing file objects that were matched. If no files were
338+
matched, `self` must be a zero length array; if a single file
339+
was matched, the value of `self` is an array of a single
340+
element. Additionally, if `loadContents` is `true`, the File
341+
objects must include up to the first 64 KiB of file contents
342+
in the `contents` field. The exit code of the process is
343+
available in the expression as `runtime.exitCode`.
335344
336345
- name: CommandLineBindable
337346
type: record
@@ -445,7 +454,6 @@ $graph:
445454
fields:
446455
- name: type
447456
type:
448-
- "null"
449457
- CWLType
450458
- stdin
451459
- CommandInputRecordSchema
@@ -480,7 +488,6 @@ $graph:
480488
fields:
481489
- name: type
482490
type:
483-
- "null"
484491
- CWLType
485492
- stdout
486493
- stderr

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ $graph:
8888
* [Added](#LoadListingRequirement) `LoadListingRequirement`
8989
and [loadListing](#LoadContents) to control whether and how
9090
`Directory` listings should be loaded for use in expressions.
91+
* [Better explain](#map) the `map<…>` notation that has existed since v1.0.
92+
* Fixed schema error where the `type` field inside the `inputs` and
93+
`outputs` fields for both `Workflow` and `ExpressionTool` was
94+
incorrectly listed as optional.
95+
* For multi-Process CWL documents, if no particular process is named then
96+
the process with the `id` of `#main` is chosen.
9197
9298
See also the [CWL Command Line Tool Description, v1.1.0-dev1 changelog](CommandLineTool.html#Changelog).
9399
@@ -110,7 +116,6 @@ $graph:
110116
fields:
111117
- name: type
112118
type:
113-
- "null"
114119
- CWLType
115120
- OutputRecordSchema
116121
- OutputEnumSchema
@@ -139,7 +144,6 @@ $graph:
139144
fields:
140145
- name: type
141146
type:
142-
- "null"
143147
- CWLType
144148
- InputRecordSchema
145149
- InputEnumSchema
@@ -235,7 +239,6 @@ $graph:
235239
If not specified, the default method is "merge_nested".
236240
- name: type
237241
type:
238-
- "null"
239242
- CWLType
240243
- OutputRecordSchema
241244
- OutputEnumSchema

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

Lines changed: 192 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,185 @@ An implementation may formally validate the structure of a CWL document using
9191
SALAD schemas located at
9292
https://github.com/common-workflow-language/common-workflow-language/tree/master/v1.1.0-dev1
9393

94+
### map
95+
96+
Note: This section is non-normative.
97+
> type: array&lt;ComplexType&gt; |
98+
> map&lt;`key_field`, ComplexType&gt;
99+
100+
The above syntax in the CWL specifications means there are two or more ways to write the given value.
101+
102+
Option one is a array and is the most verbose option.
103+
104+
Option one generic example:
105+
```
106+
some_cwl_field:
107+
- key_field: a_complex_type1
108+
field2: foo
109+
field3: bar
110+
- key_field: a_complex_type2
111+
field2: foo2
112+
field3: bar2
113+
- key_field: a_complex_type3
114+
```
115+
116+
Option one specific example using [Workflow](Workflow.html#Workflow).[inputs](Workflow.html#WorkflowInputParameter):
117+
> array&lt;InputParameter&gt; |
118+
> map&lt;`id`, `type` | InputParameter&gt;
119+
120+
121+
```
122+
inputs:
123+
- id: workflow_input01
124+
type: string
125+
- id: workflow_input02
126+
type: File
127+
format: http://edamontology.org/format_2572
128+
```
129+
130+
Option two is enabled by the `map<…>` syntax. Instead of an array of entries we
131+
use a mapping, where one field of the `ComplexType` (here named `key_field`)
132+
becomes the key in the map, and its value is the rest of the `ComplexType`
133+
without the key field. If all of the other fields of the `ComplexType` are
134+
optional and unneeded, then we can indicate this with an empty mapping as the
135+
value: `a_complex_type3: {}`
136+
137+
Option two generic example:
138+
```
139+
some_cwl_field:
140+
a_complex_type1: # this was the "key_field" from above
141+
field2: foo
142+
field3: bar
143+
a_complex_type2:
144+
field2: foo2
145+
field3: bar2
146+
a_complex_type3: {} # we accept the defualt values for "field2" and "field3"
147+
```
148+
149+
Option two specific example using [Workflow](Workflow.html#Workflow).[inputs](Workflow.html#WorkflowInputParameter):
150+
> array&lt;InputParameter&gt; |
151+
> map&lt;`id`, `type` | InputParameter&gt;
152+
153+
154+
```
155+
inputs:
156+
workflow_input01:
157+
type: string
158+
workflow_input02:
159+
type: File
160+
format: http://edamontology.org/format_2572
161+
```
162+
163+
Option two specific example using [SoftwareRequirement](#SoftwareRequirement).[packages](#SoftwarePackage):
164+
> array&lt;SoftwarePackage&gt; |
165+
> map&lt;`package`, `specs` | SoftwarePackage&gt;
166+
167+
168+
```
169+
hints:
170+
SoftwareRequirement:
171+
packages:
172+
sourmash:
173+
specs: [ https://doi.org/10.21105/joss.00027 ]
174+
screed:
175+
version: [ "1.0" ]
176+
python: {}
177+
```
178+
`
179+
Sometimes we have a third and even more compact option denoted like this:
180+
> type: array&lt;ComplexType&gt; |
181+
> map&lt;`key_field`, `field2` | ComplexType&gt;
182+
183+
For this example, if we only need the `key_field` and `field2` when specifying
184+
our `ComplexType`s (because the other fields are optional and we are fine with
185+
their default values) then we can abbreviate.
186+
187+
Option three generic example:
188+
```
189+
some_cwl_field:
190+
a_complex_type1: foo # we accept the default value for field3
191+
a_complex_type2: foo2 # we accept the default value for field3
192+
a_complex_type3: {} # we accept the default values for "field2" and "field3"
193+
```
194+
195+
Option three specific example using [Workflow](Workflow.html#Workflow).[inputs](Workflow.html#WorkflowInputParameter):
196+
> array&lt;InputParameter&gt; |
197+
> map&lt;`id`, `type` | InputParameter&gt;
198+
199+
200+
```
201+
inputs:
202+
workflow_input01: string
203+
workflow_input02: File # we accept the default of no File format
204+
```
205+
206+
Option three specific example using [SoftwareRequirement](#SoftwareRequirement).[packages](#SoftwarePackage):
207+
> array&lt;SoftwarePackage&gt; |
208+
> map&lt;`package`, `specs` | SoftwarePackage&gt;
209+
210+
211+
```
212+
hints:
213+
SoftwareRequirement:
214+
packages:
215+
sourmash: [ https://doi.org/10.21105/joss.00027 ]
216+
python: {}
217+
```
218+
219+
220+
What if some entries we want to mix the option 2 and 3? You can!
221+
222+
Mixed option 2 and 3 generic example:
223+
```
224+
some_cwl_field:
225+
my_complex_type1: foo # we accept the default value for field3
226+
my_complex_type2:
227+
field2: foo2
228+
field3: bar2 # we did not accept the default value for field3
229+
# so we had to use the slightly expanded syntax
230+
my_complex_type3: {} # as before, we accept the default values for both
231+
# "field2" and "field3"
232+
```
233+
234+
Mixed option 2 and 3 specific example using [Workflow](Workflow.html#Workflow).[inputs](Workflow.html#WorkflowInputParameter):
235+
> array&lt;InputParameter&gt; |
236+
> map&lt;`id`, `type` | InputParameter&gt;
237+
238+
239+
```
240+
inputs:
241+
workflow_input01: string
242+
workflow_input02: # we use the longer way
243+
type: File # because we want to specify the "format" too
244+
format: http://edamontology.org/format_2572
245+
workflow_input03: {} # back to the short form as this entry
246+
# uses the default of no "type" just like the prior
247+
# examples
248+
```
249+
250+
Mixed option 2 and 3 specific example using [SoftwareRequirement](#SoftwareRequirement).[packages](#SoftwarePackage):
251+
> array&lt;SoftwarePackage&gt; |
252+
> map&lt;`package`, `specs` | SoftwarePackage&gt;
253+
254+
255+
```
256+
hints:
257+
SoftwareRequirement:
258+
packages:
259+
sourmash: [ https://doi.org/10.21105/joss.00027 ]
260+
screed:
261+
specs: [ https://github.com/dib-lab/screed ]
262+
version: [ "1.0" ]
263+
python: {}
264+
```
265+
266+
Note: The `map<…>` (compact) versions are optional, the verbose option #1 is
267+
always allowed, but for presentation reasons option 3 and 2 may be preferred
268+
by human readers.
269+
270+
The normative explanation for these variations, aimed at implementors, is in the
271+
[Schema Salad specification](SchemaSalad.html#Identifier_maps).
272+
94273
## Identifiers
95274

96275
If an object contains an `id` field, that is used to uniquely identify the
@@ -187,15 +366,19 @@ of [process requirements](#Requirements_and_hints).
187366
The generic execution sequence of a CWL process (including workflows and
188367
command line line tools) is as follows.
189368

190-
1. Load, process and validate a CWL document, yielding a process object.
191-
2. Load input object.
192-
3. Validate the input object against the `inputs` schema for the process.
193-
4. Validate process requirements are met.
194-
5. Perform any further setup required by the specific process type.
195-
6. Execute the process.
196-
7. Capture results of process execution into the output object.
197-
8. Validate the output object against the `outputs` schema for the process.
198-
9. Report the output object to the process caller.
369+
1. Load input object.
370+
1. Load, process and validate a CWL document, yielding one or more process objects.
371+
1. If there are multiple process objects (due to [`$graph`](SchemaSalad.html#Document_graph))
372+
and which process object to start with is not specified in the input object (via
373+
a [`cwl:tool`](#Executing_CWL_documents_as_scripts) entry) or by any other means
374+
(like a URL fragment) then choose the process with the `id` of "#main" or "main".
375+
1. Validate the input object against the `inputs` schema for the process.
376+
1. Validate process requirements are met.
377+
1. Perform any further setup required by the specific process type.
378+
1. Execute the process.
379+
1. Capture results of process execution into the output object.
380+
1. Validate the output object against the `outputs` schema for the process.
381+
1. Report the output object to the process caller.
199382

200383
## Requirements and hints
201384

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ providing the fields `successCodes`, `temporaryFailCodes`, and
146146
`permanentFailCodes`. An implementation may choose to default unspecified
147147
non-zero exit codes to either `temporaryFailure` or `permanentFailure`.
148148

149+
The exit code of the process is available to expressions in
150+
`outputEval` as `runtime.exitCode`.
151+
149152
## Output binding
150153

151154
If the output directory contains a file named "cwl.output.json", that file

0 commit comments

Comments
 (0)