Skip to content

Commit 0156efa

Browse files
author
Anton Khodak
committed
Merge branch 'master' into fix/concat-vf
2 parents 74b0537 + 3ebbb75 commit 0156efa

Some content is hidden

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

52 files changed

+97
-3
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: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,27 @@ def arg_parser(): # type: () -> argparse.ArgumentParser
4949
default=True, help="Do not delete Docker container used by jobs after they exit",
5050
dest="rm_container")
5151

52+
cidgroup = parser.add_argument_group("Options for recording the Docker "
53+
"container identifier into a file")
54+
cidgroup.add_argument("--record-container-id", action="store_true",
55+
default=False,
56+
help="If enabled, store the Docker container ID into a file. "
57+
"See --cidfile-dir to specify the directory.",
58+
dest="record_container_id")
59+
60+
cidgroup.add_argument("--cidfile-dir", type=Text,
61+
help="Directory for storing the Docker container ID file. "
62+
"The default is the current directory",
63+
default="",
64+
dest="cidfile_dir")
65+
66+
cidgroup.add_argument("--cidfile-prefix", type=Text,
67+
help="Specify a prefix to the container ID filename. "
68+
"Final file name will be followed by a timestamp. "
69+
"The default is no prefix.",
70+
default="",
71+
dest="cidfile_prefix")
72+
5273
parser.add_argument("--tmpdir-prefix", type=Text,
5374
help="Path prefix for temporary directories",
5475
default="tmp")
@@ -127,6 +148,9 @@ def arg_parser(): # type: () -> argparse.ArgumentParser
127148
exgroup.add_argument("--quiet", action="store_true", help="Only print warnings and errors.")
128149
exgroup.add_argument("--debug", action="store_true", help="Print even more logging")
129150

151+
parser.add_argument("--timestamps", action="store_true", help="Add "
152+
"timestamps to the errors, warnings, and "
153+
"notifications.")
130154
parser.add_argument("--js-console", action="store_true", help="Enable javascript console output")
131155
parser.add_argument("--user-space-docker-cmd",
132156
help="(Linux/OS X only) Specify a user space docker "
@@ -370,4 +394,4 @@ def generate_parser(toolparser, tool, namemap, records):
370394
default = inp.get("default", None)
371395
add_argument(toolparser, name, inptype, records, description, default)
372396

373-
return toolparser
397+
return toolparser

cwltool/job.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import subprocess
1212
import sys
1313
import tempfile
14+
import datetime
1415
from io import open
1516
from typing import (IO, Any, Callable, Dict, Iterable, List, MutableMapping, Text,
1617
Tuple, Union, cast)
@@ -363,8 +364,10 @@ def add_volumes(self, pathmapper, runtime):
363364
docker_windows_path_adjust(vol.target)))
364365

365366
def run(self, pull_image=True, rm_container=True,
367+
record_container_id=False, cidfile_dir="",
368+
cidfile_prefix="",
366369
rm_tmpdir=True, move_outputs="move", **kwargs):
367-
# type: (bool, bool, bool, Text, **Any) -> None
370+
# type: (bool, bool, bool, Text, Text, bool, Text, **Any) -> None
368371

369372
(docker_req, docker_is_req) = get_feature(self, "DockerRequirement")
370373

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

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

cwltool/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ def main(argsl=None, # type: List[str]
424424
'cachedir': None,
425425
'quiet': False,
426426
'debug': False,
427+
'timestamps': False,
427428
'js_console': False,
428429
'version': False,
429430
'enable_dev': False,
@@ -452,6 +453,10 @@ def main(argsl=None, # type: List[str]
452453
_logger.setLevel(logging.WARN)
453454
if args.debug:
454455
_logger.setLevel(logging.DEBUG)
456+
if args.timestamps:
457+
formatter = logging.Formatter("[%(asctime)s] %(message)s",
458+
"%Y-%m-%d %H:%M:%S")
459+
stderr_handler.setFormatter(formatter)
455460

456461
if args.version:
457462
print(versionfunc())

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

tests/checker_wf/functional-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/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
inputs:

0 commit comments

Comments
 (0)