Skip to content

Commit cb78824

Browse files
authored
Merge pull request #236 from common-workflow-language/directory
Directory and file type schema
2 parents a90b71f + fcc5374 commit cb78824

File tree

99 files changed

+568
-223
lines changed

Some content is hidden

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

99 files changed

+568
-223
lines changed

draft-3/examples/arguments.cwl

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
cwlVersion: cwl:draft-3
22
class: CommandLineTool
3+
label: Example trivial wrapper for Java 7 compiler
34
baseCommand: javac
45
hints:
56
- class: DockerRequirement

draft-4/CommandLineTool.yml

+62-45
Original file line numberDiff line numberDiff line change
@@ -79,30 +79,6 @@ $graph:
7979
- {$include: concepts.md}
8080
- {$include: invocation.md}
8181

82-
- type: record
83-
name: FileDef
84-
doc: |
85-
Define a file that must be placed in the designated output directory
86-
prior to executing the command line tool. May be the result of executing
87-
an expression, such as building a configuration file from a template.
88-
fields:
89-
- name: "filename"
90-
type: ["string", "#Expression"]
91-
doc: "The name of the file to create in the output directory."
92-
- name: "fileContent"
93-
type: ["string", "#Expression"]
94-
doc: |
95-
If the value is a string literal or an expression which evaluates to a
96-
string, a new file must be created with the string as the file contents.
97-
98-
If the value is an expression that evaluates to a File object, this
99-
indicates the referenced file should be added to the designated output
100-
directory prior to executing the tool.
101-
102-
Files added in this way may be read-only, and may be provided
103-
by bind mounts or file system links to avoid
104-
unnecessary copying of the input file.
105-
10682

10783
- type: record
10884
name: EnvironmentDef
@@ -248,17 +224,6 @@ $graph:
248224
the File objects must include up to the first 64 KiB of file contents
249225
in the `contents` field.
250226
251-
- name: initialWorkDir
252-
type: record
253-
doc: |
254-
Setup a working directory based on a number of input files (and/or directories)
255-
fields:
256-
- name: dirDef
257-
type:
258-
type: "array"
259-
items: [ "#FileDef", "#File", "#Directory" ]
260-
doc: list of files and/or directories
261-
262227
263228
- name: CommandInputRecordField
264229
type: record
@@ -499,7 +464,7 @@ $graph:
499464
type:
500465
- "null"
501466
- type: array
502-
items: [string, "#CommandLineBinding"]
467+
items: [string, "#Expression", "#CommandLineBinding"]
503468
jsonldPredicate:
504469
"_id": "cwl:arguments"
505470
"_container": "@list"
@@ -665,20 +630,72 @@ $graph:
665630
IRI such as an [RRID](http://www.identifiers.org/rrid/SCR_001156).
666631
Example: `http://identifiers.org/rrid/RRID:SCR_001156`
667632
668-
- name: CreateFileRequirement
633+
- name: DirentExt
669634
type: record
670-
extends: "#ProcessRequirement"
671635
doc: |
672-
Define a list of files that must be created by the workflow
673-
platform in the designated output directory prior to executing the command
674-
line tool. See `FileDef` for details.
636+
Define a file or subdirectory that must be placed in the designated output
637+
directory prior to executing the command line tool. May be the result of
638+
executing an expression, such as building a configuration file from a
639+
template.
675640
fields:
676-
- name: fileDef
641+
- name: entryname
642+
type: [string, Expression]
643+
jsonldPredicate:
644+
_id: cwl:entryname
645+
doc: |
646+
The name of the file or subdirectory to create in the output directory.
647+
- name: entry
648+
type: [string, Expression]
649+
jsonldPredicate:
650+
_id: cwl:entry
651+
doc: |
652+
If the value is a string literal or an expression which evaluates to a
653+
string, a new file must be created with the string as the file contents.
654+
655+
If the value is an expression that evaluates to a `File` object, this
656+
indicates the referenced file should be added to the designated output
657+
directory prior to executing the tool.
658+
659+
If the value is an expression that evaluates to a `Dirent` object, this
660+
indicates that the File or Directory in `entry` should be added to the
661+
designated output directory with the name in `entryname`.
662+
663+
If `writable` is false, the file may be made available using a bind
664+
mount or file system link to avoid unnecessary copying of the input
665+
file.
666+
- name: writable
667+
type: boolean?
668+
doc: |
669+
If true, the file or directory must be writable by the tool. Changes
670+
to the file or directory must be isolated and not visible by any other
671+
CommandLineTool process. This may be implemented by making a copy of
672+
the original file or directory. Default false (files and directories
673+
read-only by default).
674+
675+
- name: InitialWorkDirRequirement
676+
type: record
677+
extends: ProcessRequirement
678+
doc:
679+
Define a list of files and subdirectories that must be created by the
680+
workflow platform in the designated output directory prior to executing the
681+
command line tool.
682+
fields:
683+
- name: listing
677684
type:
678-
type: "array"
679-
items: "#FileDef"
680-
doc: The list of files.
685+
- type: array
686+
items: [File, DirentExt]
687+
- string
688+
- Expression
689+
jsonldPredicate:
690+
_id: "cwl:listing"
691+
mapSubject: entryname
692+
mapPredicate: entry
693+
doc: |
694+
The list of files or subdirectories that must be placed in the
695+
designated output directory prior to executing the command line tool.
681696
697+
May be an expression. If so, the expression return value must validate
698+
as `{type: array, items: [File, Dirent]}`.
682699
683700
- name: EnvVarRequirement
684701
type: record

draft-4/Process.yml

+128-16
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@ $graph:
3333
- cwl:draft-3
3434
- cwl:draft-4.dev1
3535
- cwl:draft-4.dev2
36+
- cwl:draft-4.dev3
3637

3738
- name: CWLType
3839
type: enum
3940
extends: "sld:PrimitiveType"
4041
symbols:
4142
- cwl:File
43+
- cwl:Directory
4244
doc:
4345
- "Extends primitive types with the concept of a file as a first class type."
4446
- "File: A File object"
47+
- "Directory: A Directory object"
4548

4649
- name: File
4750
type: record
@@ -58,28 +61,95 @@ $graph:
5861
symbols:
5962
- cwl:File
6063
jsonldPredicate:
61-
"_id": "@type"
62-
"_type": "@vocab"
64+
_id: "@type"
65+
_type: "@vocab"
6366
doc: Must be `File` to indicate this object describes a file.
64-
- name: path
67+
- name: location
6568
type: string
66-
doc: The path to the file.
69+
doc: |
70+
A URI that identifies the file resource. This may be a relative
71+
reference, in which case it must be resolved using the base URI of the
72+
document. The location may refer to a local or remote resource; the
73+
implementation must use the URI to retrieve file content. If an
74+
implementation is unable to retrieve the file content stored at a
75+
remote resource (due to unsupported protocol, access denied, or other
76+
issue) it must signal an error.
77+
78+
If the `path` field is provided but the `location` field is not, an
79+
implementation may assign the value of the `path` field to `location`,
80+
then follow the rules above.
81+
jsonldPredicate:
82+
_id: "@id"
83+
_type: "@id"
84+
- name: path
85+
type: string?
86+
doc: |
87+
The local path where the File is made available prior to executing a
88+
CommandLineTool. This must be set by the implementation. This field
89+
must not be used in any other context. The command line tool being
90+
executed must be able to to access the file at `path` using the POSIX
91+
`open(2)` syscall.
6792
jsonldPredicate:
6893
"_id": "cwl:path"
6994
"_type": "@id"
95+
- name: basename
96+
type: string?
97+
doc: |
98+
The base name of the file, that is, the path component following the
99+
final slash in the path.
100+
101+
The implementation must set this field based on the value of `path`
102+
prior to evaluating parameter references or expressions in a
103+
CommandLineTool document. This field must not be used in any other
104+
context.
105+
- name: dirname
106+
type: string?
107+
doc: |
108+
The name of the directory containing file, that is, the path leading up
109+
to the final slash in the path such that `dirname + '/' + basename =
110+
path`.
111+
112+
The implementation must set this field based on the value of `path`
113+
prior to evaluating parameter references or expressions in a
114+
CommandLineTool document. This field must not be used in any other
115+
context.
116+
- name: nameroot
117+
type: string?
118+
doc: |
119+
The basename root such that `nameroot + nameext == basename`, and
120+
`nameext` is empty or begins with a period and contains at most one
121+
period. Leading periods on the basename are ignored; a basename of
122+
`.cshrc` will have a nameroot of `.cshrc`.
123+
124+
The implementation must set this field based on the value of `path`
125+
prior to evaluating parameter references or expressions in a
126+
CommandLineTool document. This field must not be used in any other
127+
context.
128+
- name: nameext
129+
type: string?
130+
doc: |
131+
The basename extension such that `nameroot + nameext == basename`, and
132+
`nameext` is empty or begins with a period and contains at most one
133+
period. Leading periods on the basename are ignored; a basename of
134+
`.cshrc` will have an empty `nameext`.
135+
136+
The implementation must set this field based on the value of `path`
137+
prior to evaluating parameter references or expressions in a
138+
CommandLineTool document. This field must not be used in any other
139+
context.
70140
- name: checksum
71141
type: ["null", string]
72142
doc: |
73143
Optional hash code for validating file integrity. Currently must be in the form
74-
"sha1$ + hexidecimal string" using the SHA-1 algorithm.
144+
"sha1$ + hexadecimal string" using the SHA-1 algorithm.
75145
- name: size
76146
type: ["null", long]
77147
doc: Optional file size.
78148
- name: "secondaryFiles"
79149
type:
80150
- "null"
81151
- type: array
82-
items: "#File"
152+
items: [File, Dirent]
83153
jsonldPredicate: "cwl:secondaryFiles"
84154
doc: |
85155
A list of additional files that are associated with the primary file
@@ -111,12 +181,24 @@ $graph:
111181
runtime may perform exact file format matches.
112182
113183
184+
- name: Dirent
185+
type: record
186+
fields:
187+
- name: entryname
188+
type: string
189+
jsonldPredicate:
190+
"_id": cwl:entryname
191+
- name: entry
192+
type: [File, Directory]
193+
jsonldPredicate:
194+
"_id": cwl:entry
195+
114196
- name: Directory
115197
type: record
116198
docParent: "#CWLType"
117199
doc: |
118200
Represents a directory to present to a command line tool. This could be a virtual
119-
directory, made of files assembled from a number of concrete directories.
201+
directory, made of files assembled from multiple locations.
120202
fields:
121203
- name: class
122204
type:
@@ -125,18 +207,48 @@ $graph:
125207
symbols:
126208
- cwl:Directory
127209
jsonldPredicate:
128-
"_id": "@type"
129-
"_type": "@vocab"
210+
_id: "@type"
211+
_type: "@vocab"
130212
doc: Must be `Directory` to indicate this object describes a Directory.
131-
- name: path
213+
- name: location
132214
type: string
133-
doc: The path to the directory.
215+
doc: |
216+
A URI that identifies the directory resource. This may be a relative
217+
reference, in which case it must be resolved using the base URI of the
218+
document. The location may refer to a local or remote resource. If
219+
the `listing` field is not set, the implementation must use the
220+
location URI to retrieve directory listing. If an implementation is
221+
unable to retrieve the directory listing stored at a remote resource (due to
222+
unsupported protocol, access denied, or other issue) it must signal an
223+
error.
224+
225+
If the `path` field is provided but the `location` field is not, an
226+
implementation may assign the value of the `path` field to `location`,
227+
then follow the rules above.
134228
jsonldPredicate:
135-
"_id": "cwl:path"
136-
"_type": "@id"
137-
# - name: size
138-
# type: ["null", long]
139-
# doc: Optional directory size.
229+
_id: "@id"
230+
_type: "@id"
231+
- name: path
232+
type: string?
233+
doc: |
234+
The local path where the Directory is made available prior to executing a
235+
CommandLineTool. This must be set by the implementation. This field
236+
must not be used in any other context. The command line tool being
237+
executed must be able to to access the directory at `path` using the POSIX
238+
`opendir(2)` syscall.
239+
jsonldPredicate:
240+
_id: "cwl:path"
241+
_type: "@id"
242+
- name: listing
243+
type:
244+
- "null"
245+
- type: array
246+
items: [File, Dirent]
247+
doc: List of files or subdirectories contained in this directory
248+
jsonldPredicate:
249+
_id: "cwl:listing"
250+
mapSubject: entryname
251+
mapPredicate: entry
140252

141253
- name: SchemaBase
142254
type: record

0 commit comments

Comments
 (0)