Skip to content

Commit f2745cb

Browse files
authored
Merge branch 'master' into patch-1
2 parents 2cf6d68 + 9564713 commit f2745cb

File tree

115 files changed

+28442
-2094
lines changed

Some content is hidden

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

115 files changed

+28442
-2094
lines changed

.coveragerc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
[run]
22
branch = True
33
source = cwltool
4+
5+
[report]
6+
exclude_lines =
7+
if self.debug:
8+
pragma: no cover
9+
raise NotImplementedError
10+
if __name__ == .__main__.:
11+
ignore_errors = True
12+
omit =
13+
tests/*

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,16 @@ typeshed/2and3/ruamel/yaml
3030

3131
#mypy
3232
.mypy_cache/
33+
34+
# Files generated by Makefile
35+
.cache/
36+
cache/
37+
.coverage
38+
coverage.xml
39+
htmlcov
40+
output
41+
output.txt
42+
pydocstyle_report.txt
43+
response.txt
44+
test.txt
45+
value

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
sudo: false
22
language: python
3+
cache: pip
34
python:
45
- 2.7
5-
- 3.3
66
- 3.4
77
- 3.5
88
- 3.6
99
os:
1010
- linux
1111
install:
1212
- pip install tox-travis
13+
jobs:
14+
include:
15+
- stage: release-test
16+
script: RELEASE_SKIP=head ./release-test.sh
1317
script: tox
1418
branches:
1519
only:
1620
- master
1721
notifications:
18-
email: false
22+
email: false

CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
In order to contribute to the development of ``cwltool``, you need to install cwltool from source (preferably in a virtual environment):
2+
Here's a rough
3+
- Install virtualenv via pip: ``pip install virtualenv``
4+
- Clone the cwltool: ``git clone https://github.com/common-workflow-language/cwltool.git``
5+
- Switch to cwltool directory: ``cd cwltool``
6+
- Create a virtual environment: ``virtualenv cwltool``
7+
- To begin using the virtual environment, it needs to be activated: ``source bin/activate``
8+
- To check if you have the virtual environment set up: ``which python`` and it should point to python executable in your virtual env
9+
- Install cwltool in the virtual environment: ``pip install .``
10+
- Check the version which might be different from the version installed in general on any system: ``cwltool --version``
11+
- After you've made the changes, you can the complete test suite via tox: ``tox``
12+
- If you want to run specific tests, say ``unit tests`` in Python 3.5, then: ``tox -e py35-unit``.
13+
- Look at ``tox.ini`` for all available tests and runtimes
14+
- If tests are passing, you can simply commit and create a PR on ``cwltool`` repo:
15+
- After you're done working on the ``cwltool``, you can deactivate the virtual environment: ``deactivate``

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ include gittaggers.py Makefile cwltool.py
22
include tests/*
33
include tests/tmp1/tmp2/tmp3/.gitkeep
44
include tests/wf/*
5+
include tests/override/*
56
include cwltool/schemas/v1.0/*.yml
67
include cwltool/schemas/draft-2/*.yml
78
include cwltool/schemas/draft-3/*.yml
@@ -17,6 +18,10 @@ include cwltool/schemas/v1.1.0-dev1/*.md
1718
include cwltool/schemas/v1.1.0-dev1/salad/schema_salad/metaschema/*.yml
1819
include cwltool/schemas/v1.1.0-dev1/salad/schema_salad/metaschema/*.md
1920
include cwltool/cwlNodeEngine.js
21+
include cwltool/cwlNodeEngineJSConsole.js
22+
include cwltool/cwlNodeEngineWithContext.js
2023
include cwltool/extensions.yml
24+
include cwltool/jshint/jshint_wrapper.js
25+
include cwltool/jshint/jshint.js
2126
global-exclude *~
2227
global-exclude *.pyc

Makefile

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ MODULE=cwltool
2727
# `[[` conditional expressions.
2828
PYSOURCES=$(wildcard ${MODULE}/**.py tests/*.py) setup.py
2929
DEVPKGS=pep8 diff_cover autopep8 pylint coverage pydocstyle flake8 pytest isort mock
30-
DEBDEVPKGS=pep8 python-autopep8 pylint python-coverage pydocstyle sloccount python-flake8 python-mock
31-
VERSION=1.0.$(shell date +%Y%m%d%H%M%S --date=`git log --first-parent \
30+
DEBDEVPKGS=pep8 python-autopep8 pylint python-coverage pydocstyle sloccount \
31+
python-flake8 python-mock shellcheck
32+
VERSION=1.0.$(shell date +%Y%m%d%H%M%S --utc --date=`git log --first-parent \
3233
--max-count=1 --format=format:%cI`)
3334
mkfile_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
3435

@@ -56,7 +57,7 @@ install: FORCE
5657
dist: dist/${MODULE}-$(VERSION).tar.gz
5758

5859
dist/${MODULE}-$(VERSION).tar.gz: $(SOURCES)
59-
./setup.py sdist
60+
./setup.py sdist bdist_wheel
6061

6162
## clean : clean up all temporary / machine-generated files
6263
clean: FORCE
@@ -89,7 +90,7 @@ pydocstyle_report.txt: $(PYSOURCES)
8990
pydocstyle setup.py $^ > pydocstyle_report.txt 2>&1 || true
9091

9192
diff_pydocstyle_report: pydocstyle_report.txt
92-
diff-quality --violations=pep8 $^
93+
diff-quality --violations=pycodestyle $^
9394

9495
## autopep8 : fix most Python code indentation and formatting
9596
autopep8: $(PYSOURCES)
@@ -112,23 +113,18 @@ pylint_report.txt: ${PYSOURCES}
112113
diff_pylint_report: pylint_report.txt
113114
diff-quality --violations=pylint pylint_report.txt
114115

115-
.coverage: $(PYSOURCES) all
116-
export COVERAGE_PROCESS_START=${mkfile_dir}.coveragerc; \
117-
cd ${CWL}; ./run_test.sh RUNNER=cwltool
118-
coverage run setup.py test
119-
coverage combine ${CWL} ${CWL}/draft-3/ ./
116+
.coverage: tests
117+
118+
coverage: .coverage
119+
coverage report
120120

121121
coverage.xml: .coverage
122-
python-coverage xml
122+
coverage xml
123123

124124
coverage.html: htmlcov/index.html
125125

126126
htmlcov/index.html: .coverage
127-
python-coverage html
128-
@echo Test coverage of the Python code is now in htmlcov/index.html
129-
130-
coverage-report: .coverage
131-
python-coverage report
127+
coverage html
132128

133129
diff-cover: coverage-gcovr.xml coverage.xml
134130
diff-cover coverage-gcovr.xml coverage.xml
@@ -138,8 +134,8 @@ diff-cover.html: coverage-gcovr.xml coverage.xml
138134
--html-report diff-cover.html
139135

140136
## test : run the ${MODULE} test suite
141-
test: FORCE
142-
./setup.py test
137+
test: $(PYSOURCES)
138+
python setup.py test --addopts "--cov cwltool"
143139

144140
sloccount.sc: ${PYSOURCES} Makefile
145141
sloccount --duplicates --wide --details $^ > sloccount.sc
@@ -160,7 +156,7 @@ mypy2: ${PYSOURCES}
160156
rm -Rf typeshed/2and3/schema_salad
161157
ln -s $(shell python -c 'from __future__ import print_function; import schema_salad; import os.path; print(os.path.dirname(schema_salad.__file__))') \
162158
typeshed/2and3/schema_salad
163-
MYPYPATH=$MYPYPATH:typeshed/2.7:typeshed/2and3 mypy --py2 --disallow-untyped-calls \
159+
MYPYPATH=$$MYPYPATH:typeshed/2.7:typeshed/2and3 mypy --py2 --disallow-untyped-calls \
164160
--warn-redundant-casts \
165161
cwltool
166162

@@ -171,8 +167,21 @@ mypy3: ${PYSOURCES}
171167
rm -Rf typeshed/2and3/schema_salad
172168
ln -s $(shell python3 -c 'from __future__ import print_function; import schema_salad; import os.path; print(os.path.dirname(schema_salad.__file__))') \
173169
typeshed/2and3/schema_salad
174-
MYPYPATH=$MYPYPATH:typeshed/3:typeshed/2and3 mypy --disallow-untyped-calls \
170+
MYPYPATH=$$MYPYPATH:typeshed/3:typeshed/2and3 mypy --disallow-untyped-calls \
175171
--warn-redundant-casts \
176172
cwltool
177173

174+
release: FORCE
175+
./release-test.sh
176+
. testenv2/bin/activate && \
177+
testenv2/src/${MODULE}/setup.py sdist bdist_wheel && \
178+
pip install twine && \
179+
twine upload testenv2/src/${MODULE}/dist/* && \
180+
git tag ${VERSION} && git push --tags
181+
178182
FORCE:
183+
184+
# Use this to print the value of a Makefile variable
185+
# Example `make print-VERSION`
186+
# From https://www.cmcrossroads.com/article/printing-value-makefile-variable
187+
print-% : ; @echo $* = $($*)

README.rst

Lines changed: 96 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ It is highly recommended to setup virtual environment before installing `cwltool
3131
virtualenv -p python2 venv # Create a virtual environment, can use `python3` as well
3232
source venv/bin/activate # Activate environment before installing `cwltool`
3333
34-
1. Installing the official package from PyPi (will install "cwltool" package as
34+
Installing the official package from PyPi (will install "cwltool" package as
3535
well)
3636

3737
.. code:: bash
@@ -44,7 +44,7 @@ If installing alongside another CWL implementation then
4444
4545
pip install cwltool
4646
47-
2. To install from source
47+
Or you can install from source:
4848

4949
.. code:: bash
5050
@@ -62,9 +62,16 @@ Running tests locally
6262

6363
- Running basic tests ``(/tests)``:
6464

65-
We use `tox <https://github.com/common-workflow-language/cwltool/tree/master/tox.ini>`_
66-
to run various tests in all supported Python environments.
67-
You can run the test suite by simply running the following in the terminal:
65+
To run the basis tests after installing `cwltool` execute the following:
66+
67+
.. code:: bash
68+
69+
pip install pytest mock
70+
py.test --ignore cwltool/schemas/ --pyarg cwltool
71+
72+
To run various tests in all supported Python environments we use `tox <https://github.com/common-workflow-language/cwltool/tree/master/tox.ini>`_. To run the test suite in all supported Python environments
73+
first downloading the complete code repository (see the ``git clone`` instructions above) and then run
74+
the following in the terminal:
6875
``pip install tox; tox``
6976

7077
List of all environment can be seen using:
@@ -106,6 +113,42 @@ and ``--tmp-outdir-prefix`` to somewhere under ``/Users``::
106113
.. |Build Status| image:: https://ci.commonwl.org/buildStatus/icon?job=cwltool-conformance
107114
:target: https://ci.commonwl.org/job/cwltool-conformance/
108115

116+
Using user-space replacements for Docker
117+
----------------------------------------
118+
119+
Some shared computing environments don't support Docker software containers for technical or policy reasons.
120+
As a work around, the CWL reference runner supports using a alternative ``docker`` implementations on Linux
121+
with the ``--user-space-docker-cmd`` option.
122+
123+
One such "user space" friendly docker replacement is ``udocker`` https://github.com/indigo-dc/udocker and another
124+
is ``dx-docker`` https://wiki.dnanexus.com/Developer-Tutorials/Using-Docker-Images
125+
126+
udocker installation: https://github.com/indigo-dc/udocker/blob/master/doc/installation_manual.md#22-install-from-indigo-datacloud-repositories
127+
128+
dx-docker installation: start with the DNAnexus toolkit (see https://wiki.dnanexus.com/Downloads for instructions).
129+
130+
Run `cwltool` just as you normally would, but with the new option, e.g. from the conformance tests:
131+
132+
.. code:: bash
133+
134+
cwltool --user-space-docker-cmd=udocker https://raw.githubusercontent.com/common-workflow-language/common-workflow-language/master/v1.0/v1.0/test-cwl-out2.cwl https://github.com/common-workflow-language/common-workflow-language/blob/master/v1.0/v1.0/empty.json
135+
136+
or
137+
138+
.. code:: bash
139+
140+
cwltool --user-space-docker-cmd=dx-docker https://raw.githubusercontent.com/common-workflow-language/common-workflow-language/master/v1.0/v1.0/test-cwl-out2.cwl https://github.com/common-workflow-language/common-workflow-language/blob/master/v1.0/v1.0/empty.json
141+
142+
``cwltool`` can use `Singularity <http://singularity.lbl.gov/>`_ as a Docker container runtime, an experimental feature.
143+
Singularity will run software containers specified in ``DockerRequirement`` and therefore works with Docker images only,
144+
native Singularity images are not supported.
145+
To use Singularity as the Docker container runtime, provide ``--singularity`` command line option to ``cwltool``.
146+
147+
148+
.. code:: bash
149+
150+
cwltool --singularity https://raw.githubusercontent.com/common-workflow-language/common-workflow-language/master/v1.0/v1.0/v1.0/cat3-tool-mediumcut.cwl https://github.com/common-workflow-language/common-workflow-language/blob/master/v1.0/v1.0/cat-job.json
151+
109152
Tool or workflow loading from remote or local locations
110153
-------------------------------------------------------
111154

@@ -164,7 +207,7 @@ The easiest way to use cwltool to run a tool or workflow from Python is to use a
164207
Leveraging SoftwareRequirements (Beta)
165208
--------------------------------------
166209

167-
CWL tools may be decoarated with ``SoftwareRequirement`` hints that cwltool
210+
CWL tools may be decorated with ``SoftwareRequirement`` hints that cwltool
168211
may in turn use to resolve to packages in various package managers or
169212
dependency management systems such as `Environment Modules
170213
<http://modules.sourceforge.net/>`__.
@@ -193,16 +236,16 @@ following ``hint`` definition for an example CWL tool.
193236
- r93
194237
195238
Now imagine deploying cwltool on a cluster with Software Modules installed
196-
and that a ``seqtk`` module is avaialble at version ``r93``. This means cluster
197-
users likely won't have the ``seqtk`` the binary on their ``PATH`` by default but after
239+
and that a ``seqtk`` module is available at version ``r93``. This means cluster
240+
users likely won't have the binary ``seqtk`` on their ``PATH`` by default, but after
198241
sourcing this module with the command ``modulecmd sh load seqtk/r93`` ``seqtk`` is
199242
available on the ``PATH``. A simple dependency resolvers configuration file, called
200243
``dependency-resolvers-conf.yml`` for instance, that would enable cwltool to source
201244
the correct module environment before executing the above tool would simply be:
202245

203246
.. code:: yaml
204247
205-
- type: module
248+
- type: modules
206249
207250
The outer list indicates that one plugin is being enabled, the plugin parameters are
208251
defined as a dictionary for this one list item. There is only one required parameter
@@ -369,6 +412,50 @@ at the following links:
369412
- `Specifications - Implementation <https://github.com/galaxyproject/galaxy/commit/81d71d2e740ee07754785306e4448f8425f890bc>`__
370413
- `Initial cwltool Integration Pull Request <https://github.com/common-workflow-language/cwltool/pull/214>`__
371414

415+
Overriding workflow requirements at load time
416+
---------------------------------------------
417+
418+
Sometimes a workflow needs additional requirements to run in a particular
419+
environment or with a particular dataset. To avoid the need to modify the
420+
underlying workflow, cwltool supports requirement "overrides".
421+
422+
The format of the "overrides" object is a mapping of item identifier (workflow,
423+
workflow step, or command line tool) to the process requirements that should be applied.
424+
425+
.. code:: yaml
426+
427+
cwltool:overrides:
428+
echo.cwl:
429+
requirements:
430+
EnvVarRequirement:
431+
envDef:
432+
MESSAGE: override_value
433+
434+
Overrides can be specified either on the command line, or as part of the job
435+
input document. Workflow steps are identified using the name of the workflow
436+
file followed by the step name as a document fragment identifier "#id".
437+
Override identifiers are relative to the toplevel workflow document.
438+
439+
.. code:: bash
440+
441+
cwltool --overrides overrides.yml my-tool.cwl my-job.yml
442+
443+
.. code:: yaml
444+
445+
input_parameter1: value1
446+
input_parameter2: value2
447+
cwltool:overrides:
448+
workflow.cwl#step1:
449+
requirements:
450+
EnvVarRequirement:
451+
envDef:
452+
MESSAGE: override_value
453+
454+
.. code:: bash
455+
456+
cwltool my-tool.cwl my-job-with-overrides.yml
457+
458+
372459
CWL Tool Control Flow
373460
---------------------
374461

appveyor.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
version: .{build}-{branch}
22

33
environment:
4+
nodejs_version: "8"
5+
46
SYSTEMROOT: "C:\\WINDOWS"
57

68
matrix:
@@ -12,10 +14,6 @@ environment:
1214
PYTHON_VERSION: "2.7.x"
1315
PYTHON_ARCH: "64"
1416

15-
- PYTHON: "C:\\Python33-x64"
16-
PYTHON_VERSION: "3.3.x"
17-
PYTHON_ARCH: "64"
18-
1917
- PYTHON: "C:\\Python34-x64"
2018
PYTHON_VERSION: "3.4.x"
2119
PYTHON_ARCH: "64"
@@ -26,17 +24,18 @@ environment:
2624

2725

2826
install:
27+
# Get the latest stable version of Node.js or io.js
28+
- ps: Install-Product node $env:nodejs_version
2929
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
30-
- "python --version"
31-
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
3230

3331
build_script:
32+
- "%CMD_IN_ENV% python -m pip install -U setuptools pip"
33+
- "%CMD_IN_ENV% pip install pytest mock"
3434
- "%CMD_IN_ENV% pip install ."
3535

3636

3737
test_script:
38-
39-
- "%CMD_IN_ENV% python setup.py test"
38+
- "%CMD_IN_ENV% py.test --verbose -p no:cacheprovider"
4039

4140
branches:
4241
only:

0 commit comments

Comments
 (0)