|
7 | 7 |
|
8 | 8 | from typing import (Any, AnyStr, Dict, List, Sequence, Text, Union, cast)
|
9 | 9 |
|
| 10 | +from . import loghandler |
10 | 11 | from schema_salad.ref_resolver import file_uri
|
11 | 12 | from .process import (Process, shortname)
|
12 | 13 | from .resolver import ga4gh_tool_registries
|
13 | 14 | from .software_requirements import (SOFTWARE_REQUIREMENTS_ENABLED)
|
14 | 15 |
|
15 | 16 | _logger = logging.getLogger("cwltool")
|
16 | 17 |
|
17 |
| -defaultStreamHandler = logging.StreamHandler() |
18 |
| -_logger.addHandler(defaultStreamHandler) |
19 |
| -_logger.setLevel(logging.INFO) |
| 18 | +DEFAULT_TMP_PREFIX = "tmp" |
20 | 19 |
|
21 | 20 |
|
22 | 21 | def arg_parser(): # type: () -> argparse.ArgumentParser
|
23 |
| - parser = argparse.ArgumentParser(description='Reference executor for Common Workflow Language') |
| 22 | + parser = argparse.ArgumentParser( |
| 23 | + description='Reference executor for Common Workflow Language standards.') |
24 | 24 | parser.add_argument("--basedir", type=Text)
|
25 | 25 | parser.add_argument("--outdir", type=Text, default=os.path.abspath('.'),
|
26 | 26 | help="Output directory, default current directory")
|
27 | 27 |
|
28 |
| - parser.add_argument("--no-container", action="store_false", default=True, |
29 |
| - help="Do not execute jobs in a Docker container, even when specified by the CommandLineTool", |
30 |
| - dest="use_container") |
31 | 28 | parser.add_argument("--parallel", action="store_true", default=False,
|
32 | 29 | help="[experimental] Run jobs in parallel. "
|
33 | 30 | "Does not currently keep track of ResourceRequirements like the number of cores"
|
34 | 31 | "or memory and can overload this system")
|
35 |
| - parser.add_argument("--preserve-environment", type=Text, action="append", |
36 |
| - help="Preserve specific environment variable when running CommandLineTools. May be provided multiple times.", |
37 |
| - metavar="ENVVAR", |
38 |
| - default=["PATH"], |
| 32 | + envgroup = parser.add_mutually_exclusive_group() |
| 33 | + envgroup.add_argument("--preserve-environment", type=Text, action="append", |
| 34 | + help="Preserve specific environment variable when " |
| 35 | + "running CommandLineTools. May be provided multiple " |
| 36 | + "times.", metavar="ENVVAR", default=["PATH"], |
39 | 37 | dest="preserve_environment")
|
40 |
| - |
41 |
| - parser.add_argument("--preserve-entire-environment", action="store_true", |
42 |
| - help="Preserve entire parent environment when running CommandLineTools.", |
43 |
| - default=False, |
| 38 | + envgroup.add_argument("--preserve-entire-environment", action="store_true", |
| 39 | + help="Preserve all environment variable when running " |
| 40 | + "CommandLineTools.", default=False, |
44 | 41 | dest="preserve_entire_environment")
|
45 | 42 |
|
46 | 43 | exgroup = parser.add_mutually_exclusive_group()
|
@@ -75,12 +72,12 @@ def arg_parser(): # type: () -> argparse.ArgumentParser
|
75 | 72 |
|
76 | 73 | parser.add_argument("--tmpdir-prefix", type=Text,
|
77 | 74 | help="Path prefix for temporary directories",
|
78 |
| - default="tmp") |
| 75 | + default=DEFAULT_TMP_PREFIX) |
79 | 76 |
|
80 | 77 | exgroup = parser.add_mutually_exclusive_group()
|
81 | 78 | exgroup.add_argument("--tmp-outdir-prefix", type=Text,
|
82 | 79 | help="Path prefix for intermediate output directories",
|
83 |
| - default="tmp") |
| 80 | + default=DEFAULT_TMP_PREFIX) |
84 | 81 |
|
85 | 82 | exgroup.add_argument("--cachedir", type=Text, default="",
|
86 | 83 | help="Directory to cache intermediate workflow outputs to avoid recomputing steps.")
|
@@ -155,10 +152,22 @@ def arg_parser(): # type: () -> argparse.ArgumentParser
|
155 | 152 | "timestamps to the errors, warnings, and "
|
156 | 153 | "notifications.")
|
157 | 154 | parser.add_argument("--js-console", action="store_true", help="Enable javascript console output")
|
158 |
| - parser.add_argument("--user-space-docker-cmd", |
| 155 | + dockergroup = parser.add_mutually_exclusive_group() |
| 156 | + dockergroup.add_argument("--user-space-docker-cmd", metavar="CMD", |
159 | 157 | help="(Linux/OS X only) Specify a user space docker "
|
160 | 158 | "command (like udocker or dx-docker) that will be "
|
161 | 159 | "used to call 'pull' and 'run'")
|
| 160 | + dockergroup.add_argument("--singularity", action="store_true", |
| 161 | + default=False, help="[experimental] Use " |
| 162 | + "Singularity runtime for running containers. " |
| 163 | + "Requires Singularity v2.3.2+ and Linux with kernel " |
| 164 | + "version v3.18+ or with overlayfs support " |
| 165 | + "backported.") |
| 166 | + dockergroup.add_argument("--no-container", action="store_false", |
| 167 | + default=True, help="Do not execute jobs in a " |
| 168 | + "Docker container, even when `DockerRequirement` " |
| 169 | + "is specified under `hints`.", |
| 170 | + dest="use_container") |
162 | 171 |
|
163 | 172 | dependency_resolvers_configuration_help = argparse.SUPPRESS
|
164 | 173 | dependencies_directory_help = argparse.SUPPRESS
|
@@ -193,7 +202,7 @@ def arg_parser(): # type: () -> argparse.ArgumentParser
|
193 | 202 | parser.add_argument("--default-container",
|
194 | 203 | help="Specify a default docker container that will be used if the workflow fails to specify one.")
|
195 | 204 | parser.add_argument("--no-match-user", action="store_true",
|
196 |
| - help="Disable passing the current uid to 'docker run --user`") |
| 205 | + help="Disable passing the current uid to `docker run --user`") |
197 | 206 | parser.add_argument("--disable-net", action="store_true",
|
198 | 207 | help="Use docker's default networking for containers;"
|
199 | 208 | " the default is to enable networking.")
|
@@ -238,8 +247,15 @@ def arg_parser(): # type: () -> argparse.ArgumentParser
|
238 | 247 | parser.add_argument("--overrides", type=str,
|
239 | 248 | default=None, help="Read process requirement overrides from file.")
|
240 | 249 |
|
241 |
| - parser.add_argument("workflow", type=Text, nargs="?", default=None) |
242 |
| - parser.add_argument("job_order", nargs=argparse.REMAINDER) |
| 250 | + parser.add_argument("workflow", type=Text, nargs="?", default=None, |
| 251 | + metavar='cwl_document', help="path or URL to a CWL Workflow, " |
| 252 | + "CommandLineTool, or ExpressionTool. If the `inputs_object` has a " |
| 253 | + "`cwl:tool` field indicating the path or URL to the cwl_document, " |
| 254 | + " then the `workflow` argument is optional.") |
| 255 | + parser.add_argument("job_order", nargs=argparse.REMAINDER, |
| 256 | + metavar='inputs_object', help="path or URL to a YAML or JSON " |
| 257 | + "formatted description of the required input values for the given " |
| 258 | + "`cwl_document`.") |
243 | 259 |
|
244 | 260 | return parser
|
245 | 261 |
|
|
0 commit comments