Skip to content

Commit 0ee8aeb

Browse files
author
Anton Khodak
committed
Merge branch 'master' into parallel-exec
2 parents de861fd + 3ebbb75 commit 0ee8aeb

Some content is hidden

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

54 files changed

+504
-365
lines changed

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ install:
3131
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
3232

3333
build_script:
34+
- "%CMD_IN_ENV% pip install -U setuptools pip"
3435
- "%CMD_IN_ENV% pip install ."
3536

3637

cwltool/argparser.py

Lines changed: 400 additions & 0 deletions
Large diffs are not rendered by default.

cwltool/factory.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Any, Dict, Text, Tuple, Union
55

66
from . import load_tool, workflow
7+
from .argparser import get_default_args
78
from .executors import SingleJobExecutor
89
from .process import Process
910

@@ -44,7 +45,13 @@ def __init__(self,
4445
if executor is None:
4546
executor = SingleJobExecutor()
4647
self.executor = executor
47-
self.execkwargs = execkwargs
48+
49+
kwargs = get_default_args()
50+
kwargs.pop("job_order")
51+
kwargs.pop("workflow")
52+
kwargs.pop("outdir")
53+
kwargs.update(execkwargs)
54+
self.execkwargs = kwargs
4855

4956
def make(self, cwl):
5057
"""Instantiate a CWL object from a CWl document."""

cwltool/job.py

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import absolute_import
2+
23
import codecs
4+
import datetime
35
import functools
46
import io
57
import json
@@ -11,22 +13,22 @@
1113
import subprocess
1214
import sys
1315
import tempfile
14-
from threading import Lock
1516
from io import open
17+
from threading import Lock
1618
from typing import (IO, Any, Callable, Dict, Iterable, List, MutableMapping, Text,
17-
Tuple, Union, cast)
19+
Union, cast)
1820

1921
import shellescape
2022

21-
from .utils import copytree_with_merge, docker_windows_path_adjust, onWindows
2223
from . import docker
2324
from .builder import Builder
2425
from .docker_id import docker_vm_id
2526
from .errors import WorkflowException
2627
from .pathmapper import PathMapper, ensure_writable
27-
from .process import (UnsupportedRequirement, empty_subtree, get_feature,
28+
from .process import (UnsupportedRequirement, get_feature,
2829
stageFiles)
2930
from .utils import bytes2str_in_dicts
31+
from .utils import copytree_with_merge, docker_windows_path_adjust, onWindows
3032

3133
_logger = logging.getLogger("cwltool")
3234

@@ -367,8 +369,10 @@ def add_volumes(self, pathmapper, runtime):
367369
docker_windows_path_adjust(vol.target)))
368370

369371
def run(self, pull_image=True, rm_container=True,
372+
record_container_id=False, cidfile_dir="",
373+
cidfile_prefix="",
370374
rm_tmpdir=True, move_outputs="move", **kwargs):
371-
# type: (bool, bool, bool, Text, **Any) -> None
375+
# type: (bool, bool, bool, Text, Text, bool, Text, **Any) -> None
372376

373377
(docker_req, docker_is_req) = get_feature(self, "DockerRequirement")
374378

@@ -467,6 +471,26 @@ def run(self, pull_image=True, rm_container=True,
467471
# directory." but spec might change to designated temp directory.
468472
# runtime.append("--env=HOME=/tmp")
469473
runtime.append(u"--env=HOME=%s" % self.builder.outdir)
474+
475+
# add parameters to docker to write a container ID file
476+
if record_container_id:
477+
if cidfile_dir != "":
478+
if not os.path.isdir(cidfile_dir):
479+
_logger.error("--cidfile-dir %s error:\n%s", cidfile_dir,
480+
cidfile_dir + " is not a directory or "
481+
"directory doesn't exist, please check it first")
482+
exit(2)
483+
if not os.path.exists(cidfile_dir):
484+
_logger.error("--cidfile-dir %s error:\n%s", cidfile_dir,
485+
"directory doesn't exist, please create it first")
486+
exit(2)
487+
else:
488+
cidfile_dir = os.getcwd()
489+
cidfile_name = datetime.datetime.now().strftime("%Y%m%d%H%M%S-%f")+".cid"
490+
if cidfile_prefix != "":
491+
cidfile_name = str(cidfile_prefix + "-" + cidfile_name)
492+
cidfile_path = os.path.join(cidfile_dir, cidfile_name)
493+
runtime.append(u"--cidfile=%s" % cidfile_path)
470494

471495
for t, v in self.environment.items():
472496
runtime.append(u"--env=%s=%s" % (t, v))

cwltool/main.py

Lines changed: 13 additions & 357 deletions
Large diffs are not rendered by default.

jenkins.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ do
3434
# use pip2.7 and pip3 in separate loop runs
3535
pip${PYTHON_VERSION} install -U setuptools wheel pip
3636
pip${PYTHON_VERSION} install .
37-
pip${PYTHON_VERSION} install "cwltest>=1.0.20180130081614"
37+
pip${PYTHON_VERSION} install -U "cwltest>=1.0.20180130081614"
3838
pushd common-workflow-language
3939
# shellcheck disable=SC2154
4040
if [[ "$version" = *dev* ]]

tests/checker_wf/broken-wf.cwl

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env cwl-runner
12
class: Workflow
23
cwlVersion: v1.0
34
requirements:

tests/checker_wf/broken-wf2.cwl

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env cwl-runner
12
class: Workflow
23
cwlVersion: v1.0
34
requirements:

tests/checker_wf/cat.cwl

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env cwl-runner
12
cwlVersion: v1.0
23
class: CommandLineTool
34
baseCommand: cat

tests/checker_wf/echo.cwl

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env cwl-runner
12
cwlVersion: v1.0
23
class: CommandLineTool
34
baseCommand: echo

0 commit comments

Comments
 (0)