Skip to content

Commit 0561c71

Browse files
committed
Merge branch 'main' of https://github.com/common-workflow-language/cwltool into mount-only-dirs
2 parents 13d604c + 72733d9 commit 0561c71

21 files changed

+616
-618
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pep257: pydocstyle
9292
pydocstyle: $(PYSOURCES)
9393
pydocstyle --add-ignore=D100,D101,D102,D103 $^ || true
9494

95-
pydocstyle_report.txt: $(PYSOURCES)
95+
pydocstyle_report.txt: $(filter-out tests/%,${PYSOURCES})
9696
pydocstyle setup.py $^ > $@ 2>&1 || true
9797

9898
diff_pydocstyle_report: pydocstyle_report.txt

README.rst

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ intended to be feature complete and provide comprehensive validation of CWL
2121
files as well as provide other tools related to working with CWL.
2222

2323
This is written and tested for
24-
`Python <https://www.python.org/>`_ ``3.x {x = 6, 7, 8}``
24+
`Python <https://www.python.org/>`_ ``3.x {x = 6, 7, 8, 9}``
2525

2626
The reference implementation consists of two packages. The ``cwltool`` package
2727
is the primary Python module containing the reference implementation in the
@@ -31,61 +31,81 @@ The ``cwlref-runner`` package is optional and provides an additional entry point
3131
under the alias ``cwl-runner``, which is the implementation-agnostic name for the
3232
default CWL interpreter installed on a host.
3333

34-
``cwltool`` is provided by the CWL project, `a member project of Software Freedom Conservancy <https://sfconservancy.org/news/2018/apr/11/cwl-new-member-project/>`_ and our `many contributors <https://github.com/common-workflow-language/cwltool/graphs/contributors>`_.
34+
``cwltool`` is provided by the CWL project, `a member project of Software Freedom Conservancy <https://sfconservancy.org/news/2018/apr/11/cwl-new-member-project/>`_
35+
and our `many contributors <https://github.com/common-workflow-language/cwltool/graphs/contributors>`_.
3536

3637
Install
3738
-------
3839

39-
Your operating system may offer cwltool directly. For `Debian <https://tracker.debian.org/pkg/cwltool>`_ or `Ubuntu <https://launchpad.net/ubuntu/+source/cwltool>`_ try
40+
``cwltool`` packages
41+
^^^^^^^^^^^^^^^^^^^^
42+
43+
Your operating system may offer cwltool directly. For `Debian <https://tracker.debian.org/pkg/cwltool>`_, `Ubuntu <https://launchpad.net/ubuntu/+source/cwltool>`_,
44+
and similar Linux distribution try
4045

4146
.. code:: bash
4247
43-
apt-get install cwltool
48+
sudo apt-get install cwltool
4449
45-
For MacOS X, other UNIXes or Windows packages prepared by the conda-forge project. Please follow instructions of conda-forge (https://conda-forge.org/#about) for its installation, then perform:
50+
If you are running MacOS X or other UNIXes and you want to use packages prepared by the conda-forge project, then
51+
please follow the install instructions for `conda-forge <https://conda-forge.org/#about>`_ (if you haven't already) and then
4652

4753
.. code:: bash
4854
4955
conda install -c conda-forge cwltool
50-
51-
Under the hood, conda setups virtual environments before installing `cwltool` to
52-
avoid conflicting versions of the same library. When installing cwltool directly,
53-
it is recommended to do the same manually:
56+
57+
All of the above methods of installing ``cwltool`` use packages which might contain bugs already fixed in newer versions, or be missing features that you desire.
58+
If the packaged version of ``cwltool`` available to you is too old, then we recommend installing using ``pip`` and ``venv`::
5459

5560
.. code:: bash
5661
57-
virtualenv -p python3 venv # Create a virtual environment
58-
source venv/bin/activate # Activate environment before installing `cwltool`
62+
python3 -m venv env # Create a virtual environment named 'env' in the current directory
63+
source env/bin/activate # Activate environment before installing `cwltool`
5964
60-
Installing the official package from PyPi (will install "cwltool" package as
65+
Then install the latest ``cwlref-runner`` package from PyPi (which will install the latest ``cwltool`` package as
6166
well)
6267

6368
.. code:: bash
6469
6570
pip install cwlref-runner
6671
67-
If installing alongside another CWL implementation then
72+
If installing alongside another CWL implementation (like ``toil-cwl-runner`` or ``arvados-cwl-runner``) then instead run
6873

6974
.. code:: bash
7075
7176
pip install cwltool
7277
73-
Or you can install from source:
78+
MS Windows users
79+
^^^^^^^^^^^^^^^^
80+
81+
1. Install `"Windows Subsystem for Linux 2" (WSL2) and Docker Desktop <https://docs.docker.com/docker-for-windows/wsl/#prerequisites>`_
82+
2. Install `Debian from the Microsoft Store <https://www.microsoft.com/en-us/p/debian/9msvkqc78pk6>`_
83+
3. Set Debian as your default WSL 2 distro: ``wsl --set-default debian``
84+
4. Reboot if you have not yet already.
85+
5. Launch Debian and follow the Linux instructions above (``apt-get install cwltool`` or use the ``venv`` method)
86+
87+
``cwltool`` development version
88+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
89+
90+
Or you can skip the direct ``pip`` commands above and install the latest development version of ``cwltool``:
7491

7592
.. code:: bash
7693
77-
git clone https://github.com/common-workflow-language/cwltool.git # clone cwltool repo
78-
cd cwltool # Switch to source directory
79-
pip install . # Install `cwltool` from source
94+
git clone https://github.com/common-workflow-language/cwltool.git # clone (copy) the cwltool git repository
95+
cd cwltool # Change to source directory that git clone just downloaded
96+
pip install . # Installs ``cwltool`` from source
8097
cwltool --version # Check if the installation works correctly
8198
8299
Remember, if co-installing multiple CWL implementations then you need to
83100
maintain which implementation ``cwl-runner`` points to via a symbolic file
84101
system link or `another facility <https://wiki.debian.org/DebianAlternatives>`_.
85102

103+
Recommended Software
104+
^^^^^^^^^^^^^^^^^^^^
105+
86106
You may also want to have the following installed:
87-
node.js
88-
Docker, udocker, or Singularity (optional)
107+
- `node.js <https://nodejs.org/en/download/>`_
108+
- Docker, udocker, or Singularity (optional)
89109

90110
Without these, some examples in the CWL tutorials at http://www.commonwl.org/user_guide/ may not work.
91111

@@ -97,7 +117,7 @@ Simple command::
97117
cwl-runner [tool-or-workflow-description] [input-job-settings]
98118

99119
Or if you have multiple CWL implementations installed and you want to override
100-
the default cwl-runner use::
120+
the default cwl-runner then use::
101121

102122
cwltool [tool-or-workflow-description] [input-job-settings]
103123

@@ -106,8 +126,8 @@ these will be inserted at the beginning of the command line::
106126

107127
export CWLTOOL_OPTIONS="--debug"
108128

109-
Use with boot2docker
110-
--------------------
129+
Use with boot2docker on macOS
130+
-----------------------------
111131
boot2docker runs Docker inside a virtual machine and it only mounts ``Users``
112132
on it. The default behavior of CWL is to create temporary directories under e.g.
113133
``/Var`` which is not accessible to Docker containers.
@@ -117,8 +137,8 @@ and ``--tmp-outdir-prefix`` to somewhere under ``/Users``::
117137

118138
$ cwl-runner --tmp-outdir-prefix=/Users/username/project --tmpdir-prefix=/Users/username/project wc-tool.cwl wc-job.json
119139

120-
Using user-space replacements for Docker
121-
----------------------------------------
140+
Using uDocker
141+
-------------
122142

123143
Some shared computing environments don't support Docker software containers for technical or policy reasons.
124144
As a work around, the CWL reference runner supports using alternative ``docker`` implementations on Linux
@@ -132,9 +152,9 @@ Run `cwltool` just as you normally would, but with the new option, e.g. from the
132152

133153
.. code:: bash
134154
135-
cwltool --user-space-docker-cmd=udocker https://raw.githubusercontent.com/common-workflow-language/common-workflow-language/main/v1.0/v1.0/test-cwl-out2.cwl https://github.com/common-workflow-language/common-workflow-language/blob/main/v1.0/v1.0/empty.json
155+
cwltool --user-space-docker-cmd=udocker https://raw.githubusercontent.com/common-workflow-language/common-workflow-language/main/v1.0/v1.0/test-cwl-out2.cwl https://github.com/common-workflow-language/common-workflow-language/raw/main/v1.0/v1.0/empty.json
136156
137-
``cwltool`` can use `Singularity <http://singularity.lbl.gov/>`_ version 2.6.1
157+
``cwltool`` can also use `Singularity <https://github.com/hpcng/singularity/releases/>`_ version 2.6.1
138158
or later as a Docker container runtime.
139159
``cwltool`` with Singularity will run software containers specified in
140160
``DockerRequirement`` and therefore works with Docker images only, native
@@ -143,7 +163,7 @@ runtime, provide ``--singularity`` command line option to ``cwltool``.
143163
With Singularity, ``cwltool`` can pass all CWL v1.0 conformance tests, except
144164
those involving Docker container ENTRYPOINTs.
145165

146-
166+
Example:
147167
.. code:: bash
148168
149169
cwltool --singularity https://raw.githubusercontent.com/common-workflow-language/common-workflow-language/main/v1.0/v1.0/v1.0/cat3-tool-mediumcut.cwl https://github.com/common-workflow-language/common-workflow-language/blob/main/v1.0/v1.0/cat-job.json

cwltool/executors.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@
3232
from .mutation import MutationManager
3333
from .process import Process, cleanIntermediate, relocateOutputs
3434
from .provenance_profile import ProvenanceProfile
35+
from .task_queue import TaskQueue
3536
from .utils import CWLObjectType, JobsType
3637
from .workflow import Workflow
3738
from .workflow_job import WorkflowJob, WorkflowJobStep
38-
from .task_queue import TaskQueue
39-
4039

4140
TMPDIR_LOCK = Lock()
4241

cwltool/task_queue.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import queue
77
import threading
8-
98
from typing import Callable, Optional
109

1110
from .loghandler import _logger

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
requests>=2.4.3
22
ruamel.yaml>=0.12.4,<=0.16.5
3-
rdflib>=4.2.2,<4.3
3+
rdflib>=4.2.2,<5.1
44
shellescape>=3.4.1,<3.5
5-
schema-salad>=7,<8
5+
schema-salad>=7.0.20210124093443,<8
66
prov==1.5.1
77
bagit==1.6.4
88
mypy-extensions

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@
9595
"requests >= 2.6.1", # >= 2.6.1 to workaround
9696
# https://github.com/ionrock/cachecontrol/issues/137
9797
"ruamel.yaml >= 0.12.4, <= 0.16.5",
98-
"rdflib >= 4.2.2, < 4.3.0",
98+
"rdflib >= 4.2.2, < 5.1.0",
9999
"shellescape >= 3.4.1, < 3.5",
100-
"schema-salad >= 7, < 8",
100+
"schema-salad >= 7.0.20210124093443, < 8",
101101
"mypy-extensions",
102102
"psutil",
103103
"prov == 1.5.1",
@@ -121,7 +121,7 @@
121121
setup_requires=PYTEST_RUNNER,
122122
test_suite="tests",
123123
tests_require=[
124-
"pytest < 7",
124+
"pytest == 6.0.2",
125125
"mock >= 2.0.0",
126126
"pytest-mock >= 1.10.0",
127127
"arcp >= 0.2.0",

test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pytest < 7
1+
pytest == 6.0.2
22
mock >= 2.0.0
33
pytest-mock >= 1.10.0
44
pytest-cov

tests/test_docker.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
from distutils import spawn
2-
3-
import py.path
2+
from pathlib import Path
43

54
from cwltool.main import main
65

76
from .util import get_data, get_main_output, needs_docker
87

98

109
@needs_docker
11-
def test_docker_workflow(tmpdir: py.path.local) -> None:
10+
def test_docker_workflow(tmp_path: Path) -> None:
11+
"""Basic test for docker with a CWL Workflow."""
1212
result_code, _, stderr = get_main_output(
1313
[
1414
"--default-container",
1515
"debian",
1616
"--outdir",
17-
str(tmpdir),
17+
str(tmp_path),
1818
get_data("tests/wf/hello-workflow.cwl"),
1919
"--usermessage",
2020
"hello",
2121
]
2222
)
2323
assert "completed success" in stderr
24-
assert (tmpdir / "response.txt").read_text("utf-8") == "hello"
24+
assert (tmp_path / "response.txt").read_text("utf-8") == "hello"
2525
assert result_code == 0
2626

2727

tests/test_empty_input.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
from io import StringIO
2+
from pathlib import Path
23

34
from cwltool.main import main
45

5-
from .util import get_data, temp_dir, windows_needs_docker
6+
from .util import get_data, windows_needs_docker
67

78

89
@windows_needs_docker
9-
def test_empty_input() -> None:
10+
def test_empty_input(tmp_path: Path) -> None:
11+
"""Affirm that an empty input works."""
1012
empty_json = "{}"
1113
empty_input = StringIO(empty_json)
1214

13-
with temp_dir() as tmpdir:
14-
params = ["--outdir", tmpdir, get_data("tests/wf/no-parameters-echo.cwl"), "-"]
15+
params = [
16+
"--outdir",
17+
str(tmp_path),
18+
get_data("tests/wf/no-parameters-echo.cwl"),
19+
"-",
20+
]
1521

16-
try:
17-
assert main(params, stdin=empty_input) == 0
18-
except SystemExit as err:
19-
assert err.code == 0
22+
try:
23+
assert main(params, stdin=empty_input) == 0
24+
except SystemExit as err:
25+
assert err.code == 0

0 commit comments

Comments
 (0)