Skip to content

Commit 67216aa

Browse files
author
Anton Khodak
committed
Set TMPDIR on MacOS to be under the shared volume by default
1 parent f454efb commit 67216aa

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

cwltool/argparser.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
_logger = logging.getLogger("cwltool")
1717

18+
DEFAULT_TMP_PREFIX = "tmp"
19+
20+
1821
def arg_parser(): # type: () -> argparse.ArgumentParser
1922
parser = argparse.ArgumentParser(description='Reference executor for Common Workflow Language')
2023
parser.add_argument("--basedir", type=Text)
@@ -71,12 +74,12 @@ def arg_parser(): # type: () -> argparse.ArgumentParser
7174

7275
parser.add_argument("--tmpdir-prefix", type=Text,
7376
help="Path prefix for temporary directories",
74-
default="tmp")
77+
default=DEFAULT_TMP_PREFIX)
7578

7679
exgroup = parser.add_mutually_exclusive_group()
7780
exgroup.add_argument("--tmp-outdir-prefix", type=Text,
7881
help="Path prefix for intermediate output directories",
79-
default="tmp")
82+
default=DEFAULT_TMP_PREFIX)
8083

8184
exgroup.add_argument("--cachedir", type=Text, default="",
8285
help="Directory to cache intermediate workflow outputs to avoid recomputing steps.")

cwltool/main.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import ruamel.yaml as yaml
1818
import schema_salad.validate as validate
1919
import six
20+
21+
from cwltool.argparser import DEFAULT_TMP_PREFIX
2022
from schema_salad.ref_resolver import Loader, file_uri, uri_file_path
2123
from schema_salad.sourceline import strip_dup_lineno
2224

@@ -529,8 +531,16 @@ def main(argsl=None, # type: List[str]
529531
if isinstance(tool, int):
530532
return tool
531533

534+
# If on MacOS platform, TMPDIR must be set to be under one of the shared volumes in Docker for Mac
535+
# More info: https://dockstore.org/docs/faq
536+
if sys.platform == "darwin":
537+
tmp_prefix = "tmp_outdir_prefix"
538+
default_mac_path = "/private/tmp/docker_tmp"
539+
if getattr(args, tmp_prefix) and getattr(args, tmp_prefix) == DEFAULT_TMP_PREFIX:
540+
setattr(args, tmp_prefix, default_mac_path)
541+
532542
for dirprefix in ("tmpdir_prefix", "tmp_outdir_prefix", "cachedir"):
533-
if getattr(args, dirprefix) and getattr(args, dirprefix) != 'tmp':
543+
if getattr(args, dirprefix) and getattr(args, dirprefix) != DEFAULT_TMP_PREFIX:
534544
sl = "/" if getattr(args, dirprefix).endswith("/") or dirprefix == "cachedir" else ""
535545
setattr(args, dirprefix,
536546
os.path.abspath(getattr(args, dirprefix)) + sl)

0 commit comments

Comments
 (0)