Skip to content

Commit 5637775

Browse files
author
Peter Amstutz
committed
Merge branch 'shell-commands'
2 parents fd72f70 + 48830c2 commit 5637775

14 files changed

+321
-19
lines changed

cwltool/draft2tool.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import urlparse
2121
import tempfile
2222
from builder import CONTENT_LIMIT, substitute
23+
import shellescape
2324

2425
_logger = logging.getLogger("cwltool")
2526

@@ -155,7 +156,18 @@ def job(self, joborder, input_basedir, output_callback, **kwargs):
155156
for t in evr["envDef"]:
156157
j.environment[t["envName"]] = builder.do_eval(t["envValue"])
157158

158-
j.command_line = flatten(map(builder.generate_arg, builder.bindings))
159+
shellcmd, _ = self.get_requirement("ShellCommandRequirement")
160+
if shellcmd:
161+
cmd = []
162+
for b in builder.bindings:
163+
arg = builder.generate_arg(b)
164+
if b.get("shellQuote", True):
165+
arg = [shellescape.quote(a) for a in aslist(arg)]
166+
cmd.extend(aslist(arg))
167+
j.command_line = ["/bin/sh", "-c", " ".join(cmd)]
168+
print j.command_line
169+
else:
170+
j.command_line = flatten(map(builder.generate_arg, builder.bindings))
159171

160172
j.pathmapper = builder.pathmapper
161173
j.collect_outputs = functools.partial(self.collect_output_ports, self.tool["outputs"], builder)

cwltool/process.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"CreateFileRequirement",
2929
"ScatterFeatureRequirement",
3030
"SubworkflowFeatureRequirement",
31-
"MultipleInputFeatureRequirement"]
31+
"MultipleInputFeatureRequirement",
32+
"ShellCommandRequirement"]
3233

3334
def get_schema():
3435
f = resource_stream(__name__, 'schemas/draft-3/cwl-avro.yml')

cwltool/schemas/CODE_OF_CONDUCT.md

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
CWL Code of Conduct
2+
===================
3+
4+
The CWL Project is dedicated to providing a harassment-free experience for
5+
everyone. We do not tolerate harassment of participants in any form.
6+
7+
This code of conduct applies to all CWL Project spaces both online and off: the
8+
Google Group, the Gitter chat room, the Google Hangouts chats, and any other
9+
CWL spaces. Anyone who violates this code of conduct may be sanctioned or
10+
expelled from these spaces at the discretion of the CWL Leadership Team.
11+
12+
Some CWL Project spaces may have additional rules in place, which will be
13+
made clearly available to participants. Participants are responsible for
14+
knowing and abiding by these rules.
15+
16+
Harassment includes, but is not limited to:
17+
18+
- Offensive comments related to gender, gender identity and expression, sexual
19+
orientation, disability, mental illness, neuro(a)typicality, physical
20+
appearance, body size, age, race, or religion.
21+
- Unwelcome comments regarding a person’s lifestyle choices and practices,
22+
including those related to food, health, parenting, drugs, and employment.
23+
- Deliberate misgendering or use of [dead](https://www.quora.com/What-is-deadnaming/answer/Nancy-C-Walker)
24+
or rejected names.
25+
- Gratuitous or off-topic sexual images or behaviour in spaces where they’re not
26+
appropriate.
27+
- Physical contact and simulated physical contact (eg, textual descriptions like
28+
\*hug\*” or “\*backrub\*”) without consent or after a request to stop.
29+
- Threats of violence.
30+
- Incitement of violence towards any individual, including encouraging a person
31+
to commit suicide or to engage in self-harm.
32+
- Deliberate intimidation.
33+
- Stalking or following.
34+
- Harassing photography or recording, including logging online activity for
35+
harassment purposes.
36+
- Sustained disruption of discussion.
37+
- Unwelcome sexual attention.
38+
- Pattern of inappropriate social contact, such as requesting/assuming
39+
inappropriate levels of intimacy with others
40+
- Continued one-on-one communication after requests to cease.
41+
- Deliberate “outing” of any aspect of a person’s identity without their consent
42+
except as necessary to protect vulnerable people from intentional abuse.
43+
- Publication of non-harassing private communication.
44+
45+
The CWL Project prioritizes marginalized people’s safety over privileged
46+
people’s comfort. The CWL Leadeship Team will not act on complaints regarding:
47+
48+
- ‘Reverse’ -isms, including ‘reverse racism,’ ‘reverse sexism,’ and ‘cisphobia’
49+
- Reasonable communication of boundaries, such as “leave me alone,” “go away,” or
50+
“I’m not discussing this with you.”
51+
- Communicating in a [tone](http://geekfeminism.wikia.com/wiki/Tone_argument)
52+
you don’t find congenial
53+
54+
Reporting
55+
---------
56+
57+
If you are being harassed by a member of the CWL Project, notice that someone
58+
else is being harassed, or have any other concerns, please contact the CWL
59+
Leadership Team at [email protected]. If person who is harassing
60+
you is on the team, they will recuse themselves from handling your incident. We
61+
will respond as promptly as we can.
62+
63+
This code of conduct applies to CWL Project spaces, but if you are being
64+
harassed by a member of CWL Project outside our spaces, we still want to
65+
know about it. We will take all good-faith reports of harassment by CWL Project
66+
members, especially the CWL Leadership Team, seriously. This includes harassment
67+
outside our spaces and harassment that took place at any point in time. The
68+
abuse team reserves the right to exclude people from the CWL Project based on
69+
their past behavior, including behavior outside CWL Project spaces and
70+
behavior towards people who are not in the CWL Project.
71+
72+
In order to protect volunteers from abuse and burnout, we reserve the right to
73+
reject any report we believe to have been made in bad faith. Reports intended
74+
to silence legitimate criticism may be deleted without response.
75+
76+
We will respect confidentiality requests for the purpose of protecting victims
77+
of abuse. At our discretion, we may publicly name a person about whom we’ve
78+
received harassment complaints, or privately warn third parties about them, if
79+
we believe that doing so will increase the safety of CWL Project members or
80+
the general public. We will not name harassment victims without their
81+
affirmative consent.
82+
83+
Consequences
84+
------------
85+
86+
Participants asked to stop any harassing behavior are expected to comply
87+
immediately.
88+
89+
If a participant engages in harassing behavior, the CWL Leadership Team may
90+
take any action they deem appropriate, up to and including expulsion from all
91+
CWL Project spaces and identification of the participant as a harasser to other
92+
CWL Project members or the general public.
93+
94+
This anti-harassment policy is based on the [example policy from the Geek
95+
Feminism wiki](http://geekfeminism.wikia.com/wiki/Community_anti-harassment/Policy),
96+
created by the Geek Feminism community.
97+
98+
CWL Leadership Team
99+
-------------------
100+
101+
As a stop gap measure until a more formal governance structure is adopted, the
102+
following individuals make up the leadership of the CWL Project: Peter Amstutz,
103+
John Chilton, Michael R. Crusoe, and Nebojša Tijanić.
104+
105+
To report an issue with anyone on the team you can escalate to Ward Vandewege
106+
(Curoverse) [email protected], Anton Nekrutenko (Galaxy)
107+
anton AT bx DOT psu DOT edu, C. Titus Brown (UC Davis) [email protected], or
108+
Brandi Davis-Dusenbery (Seven Bridges Genomics) [email protected].

cwltool/schemas/CONFORMANCE_TESTS.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Test [1/1]
1414
All tests passed
1515
```
1616

17-
The cwltool relies on node.js. To install on ubuntu,
17+
The cwltool relies on node.js. To install on ubuntu,
1818

1919
```
2020
$ sudo apt-get install nodejs npm
@@ -51,3 +51,9 @@ All tests passed
5151
5252
All tool tests succeeded
5353
```
54+
55+
_NOTE_: For running on OSX systems, you'll need to install coreutils via brew. This will add to your
56+
system some needed GNU-like tools like `greadlink`.
57+
58+
1. If you haven't already, install [brew](http://brew.sh/) package manager in your mac
59+
2. Run `brew install coreutils`

cwltool/schemas/README.md

+41-8
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,38 @@ http://common-workflow-language.github.io/draft-3/
2626

2727
## Implementations
2828

29-
Implementations working on or currently capable of running the Common Workflow Language:
30-
31-
* [Reference implementation (Python)](https://github.com/common-workflow-language/cwltool)
32-
* [Rabix](https://github.com/rabix/rabix)
33-
* [Arvados](https://arvados.org)
34-
* [Parallel Recipes](https://github.com/yvdriess/precipes)
29+
Some of the software supporting running Common Workflow Language tools or workflows:
30+
31+
* [cwltool (reference implementation)](https://github.com/common-workflow-language/cwltool),
32+
[cwltool wiki page](https://github.com/common-workflow-language/common-workflow-language/wiki/cwltool-%28reference-implementation%29)
33+
* [Rabix](https://github.com/rabix/rabix),
34+
[Rabix wiki page](https://github.com/common-workflow-language/common-workflow-language/wiki/Rabix)
35+
* [Arvados](https://arvados.org),
36+
[Arvados wiki page](https://github.com/common-workflow-language/common-workflow-language/wiki/Arvados)
37+
* [Galaxy](https://github.com/common-workflow-language/Galaxy),
38+
[Galaxy wiki page](https://github.com/common-workflow-language/common-workflow-language/wiki/Galaxy)
39+
* [Parallel Recipes](https://github.com/yvdriess/precipes),
40+
[Parallel Recipes wiki page](https://github.com/common-workflow-language/common-workflow-language/wiki/Parallel-Recipes)
41+
* [Toil](https://github.com/BD2KGenomics/toil),
42+
[Toil wiki page](https://github.com/common-workflow-language/common-workflow-language/wiki/Toil)
43+
* [CancerCollaboratory](https://github.com/CancerCollaboratory),
44+
[CancerCollaboratory wiki page](https://github.com/common-workflow-language/common-workflow-language/wiki/CancerCollaboratory)
45+
* [Airflow (SciDAP)](https://github.com/SciDAP/scidap),
46+
[Airflow wiki page](https://github.com/common-workflow-language/common-workflow-language/wiki/SciDAP)
47+
* [cwl2script](https://github.com/common-workflow-language/cwl2script),
48+
[cwl2script page](https://github.com/common-workflow-language/common-workflow-language/wiki/cwl2script)
3549

3650
## Examples
3751

3852
[Github repository of example tools and workflows.](https://github.com/common-workflow-language/workflows)
3953

4054
## Development and testing
4155

42-
The CWL effort is on Github:
56+
The [CWL project](https://github.com/common-workflow-language/common-workflow-language)
57+
is on Github.
4358

44-
https://github.com/common-workflow-language/common-workflow-language
59+
[![GitHub
60+
stars](https://img.shields.io/github/stars/common-workflow-language/common-workflow-language.svg)](https://github.com/common-workflow-language/common-workflow-language/stargazers)
4561

4662
There is a Jenkins server maintained by Curoverse that runs tests for the
4763
reference implementation, builds and uploads packages, and builds and uploads
@@ -62,6 +78,21 @@ and send a pull request!
6278

6379
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/common-workflow-language/common-workflow-language?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
6480

81+
### Code of Conduct
82+
83+
The CWL Project is dedicated to providing a harassment-free experience for
84+
everyone, regardless of gender, gender identity and expression, sexual
85+
orientation, disability, physical appearance, body size, age, race, or
86+
religion. We do not tolerate harassment of participants in any form.
87+
88+
This code of conduct applies to all CWL Project spaces, including the Google
89+
Group, the Gitter chat room, the Google Hangouts chats, both online and off.
90+
Anyone who violates this code of conduct may be sanctioned or expelled from
91+
these spaces at the discretion of the leadership team.
92+
93+
For more details, see our [Code of
94+
Conduct](https://github.com/common-workflow-language/common-workflow-language/blob/master/CODE_OF_CONDUCT.md)
95+
6596
## Participating Organizations
6697

6798
* [Curoverse](http://curoverse.com)
@@ -73,6 +104,7 @@ and send a pull request!
73104
* [University of California Davis](http://ucdavis.edu)
74105
* [University of California Santa Cruz](https://cbse.soe.ucsc.edu/research/bioinfo)
75106
* [Harvard Chan School of Public Health](http://www.hsph.harvard.edu/)
107+
* [Cincinnati Children's Hospital Medical Center](http://www.cincinnatichildrens.org/)
76108
* [Broad Institute](https://www.broadinstitute.org)
77109
* [BioDatomics](http://www.biodatomics.com/)
78110

@@ -96,3 +128,4 @@ and send a pull request!
96128
* Josh Randall <[email protected]>
97129
* Andrey Kartashov <[email protected]>
98130
* Dan Leehr <[email protected]>
131+
* Andrey Kartashov <[email protected]>

cwltool/schemas/draft-2/draft-2/node-engine.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
requirements: [
44
{
55
class: DockerRequirement,
6-
dockerImageId: commonworkflowlanguage/nodejs-engine
6+
dockerPull: commonworkflowlanguage/nodejs-engine
77
}
88
],
99
engineCommand: cwlNodeEngine.js

cwltool/schemas/draft-3/conformance_test_draft-3.yaml

+24-1
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,27 @@
260260
size: 1111
261261
tool: draft-3/rename.cwl
262262
doc: |
263-
Test CreateFileRequirement with expression in filename.
263+
Test CreateFileRequirement with expression in filename.
264+
265+
- job: draft-3/schemadef-job.json
266+
output:
267+
output:
268+
path: output.txt
269+
size: 12
270+
class: File
271+
checksum: "sha1$f12e6cfe70f3253f70b0dbde17c692e7fb0f1e5e"
272+
tool: draft-3/schemadef-tool.cwl
273+
doc: |
274+
Test SchemaDefRequirement definition used in tool parameter
275+
276+
277+
- job: draft-3/schemadef-job.json
278+
output:
279+
output:
280+
path: output.txt
281+
size: 12
282+
class: File
283+
checksum: "sha1$f12e6cfe70f3253f70b0dbde17c692e7fb0f1e5e"
284+
tool: draft-3/schemadef-wf.cwl
285+
doc: |
286+
Test SchemaDefRequirement definition used in workflow parameter

cwltool/schemas/draft-3/cwl-avro.yml

+21-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
3535
* Luka Stojanovic <[email protected]>, Seven Bridges Genomics
3636
* John Chilton <[email protected]>, Galaxy Project, Pennsylvania State University
37-
* Michael R. Crusoe <mcrusoe@msu.edu>, Michigan State University
37+
* Michael R. Crusoe <crusoe@ucdavis.edu>, University of California, Davis
3838
* Hervé Ménager <[email protected]>, Institut Pasteur
3939
* Maxim Mikheev <[email protected]>, BioDatomics
4040
* Stian Soiland-Reyes [[email protected]](mailto:[email protected]), University of Manchester
@@ -1007,7 +1007,7 @@
10071007
Defines the input parameters of the process. The process is ready to
10081008
run when all required input parameters are associated with concrete
10091009
values. Input parameters include a schema for each parameter which is
1010-
used to validate the input object. It may also be used build a user
1010+
used to validate the input object. It may also be used to build a user
10111011
interface for constructing the input object.
10121012
- name: outputs
10131013
type:
@@ -1143,7 +1143,12 @@
11431143
11441144
When a binding is part of the `CommandLineTool.arguments` field,
11451145
the `valueFrom` field is required.
1146-
1146+
- name: shellQuote
1147+
type: ["null", boolean]
1148+
doc: |
1149+
If `ShellCommandRequirement` is in the requirements for the current command,
1150+
this controls whether the value is quoted on the command line (default is true).
1151+
Use `shellQuote: false` to inject metacharacters for operations such as pipes.
11471152
11481153
- type: record
11491154
name: CommandOutputBinding
@@ -1692,7 +1697,7 @@
16921697
16931698
A "scatter" operation specifies that the associated workflow step or
16941699
subworkflow should execute separately over a list of input elements. Each
1695-
job making up a scatter operaution is independent and may be executed
1700+
job making up a scatter operation is independent and may be executed
16961701
concurrently.
16971702
16981703
The `scatter` field specifies one or more input parameters which will be
@@ -2044,3 +2049,15 @@
20442049
the expression engine. The semantics of this field are defined by the
20452050
underlying expression engine. Intended for uses such as providing
20462051
function definitions that will be called from CWL expressions.
2052+
2053+
- type: record
2054+
name: ShellCommandRequirement
2055+
extends: "#ProcessRequirement"
2056+
doc: |
2057+
Modify the behavior of CommandLineTool to generate a single string
2058+
containing a shell command line. Each item in the argument list must be
2059+
joined into a string separated by single spaces and quoted to prevent
2060+
intepretation by the shell, unless `CommandLineBinding` for that argument
2061+
contains `shellQuote: false`. If `shellQuote: false` is specified, the
2062+
argument is joined into the command string without quoting, which allows
2063+
the use of shell metacharacters such as `|` for pipes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"hello": {
3+
"a": "hello",
4+
"b": "world"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env cwl-runner
2+
class: CommandLineTool
3+
cwlVersion: "cwl:draft-3.dev1"
4+
requirements:
5+
- "@import": node-engine.cwl
6+
- "@import": schemadef-type.yml
7+
8+
inputs:
9+
- id: "#hello"
10+
type: "schemadef-type.yml#HelloType"
11+
inputBinding:
12+
valueFrom:
13+
engine: node-engine.cwl
14+
script: |
15+
{
16+
return $self.a + "/" + $self.b;
17+
}
18+
19+
outputs:
20+
- id: "#output"
21+
type: File
22+
outputBinding:
23+
glob: output.txt
24+
25+
stdout: output.txt
26+
baseCommand: echo
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class: SchemaDefRequirement
2+
types:
3+
- name: "#HelloType"
4+
type: record
5+
fields:
6+
- name: a
7+
type: string
8+
- name: b
9+
type: string

0 commit comments

Comments
 (0)