Skip to content

Set --tmp-outdir-prefix on MacOS to be under the shared volume by default #670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cwltool/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

_logger = logging.getLogger("cwltool")

DEFAULT_TMP_PREFIX = "tmp"


def arg_parser(): # type: () -> argparse.ArgumentParser
parser = argparse.ArgumentParser(description='Reference executor for Common Workflow Language')
parser.add_argument("--basedir", type=Text)
Expand Down Expand Up @@ -71,12 +74,12 @@ def arg_parser(): # type: () -> argparse.ArgumentParser

parser.add_argument("--tmpdir-prefix", type=Text,
help="Path prefix for temporary directories",
default="tmp")
default=DEFAULT_TMP_PREFIX)

exgroup = parser.add_mutually_exclusive_group()
exgroup.add_argument("--tmp-outdir-prefix", type=Text,
help="Path prefix for intermediate output directories",
default="tmp")
default=DEFAULT_TMP_PREFIX)

exgroup.add_argument("--cachedir", type=Text, default="",
help="Directory to cache intermediate workflow outputs to avoid recomputing steps.")
Expand Down
13 changes: 11 additions & 2 deletions cwltool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
import ruamel.yaml as yaml
import schema_salad.validate as validate
import six

from schema_salad.ref_resolver import Loader, file_uri, uri_file_path
from schema_salad.sourceline import strip_dup_lineno

from . import draft2tool, workflow
from .argparser import arg_parser, generate_parser
from .argparser import arg_parser, generate_parser, DEFAULT_TMP_PREFIX
from .cwlrdf import printdot, printrdf
from .errors import UnsupportedRequirement, WorkflowException
from .executors import SingleJobExecutor, MultithreadedJobExecutor
Expand Down Expand Up @@ -529,8 +530,16 @@ def main(argsl=None, # type: List[str]
if isinstance(tool, int):
return tool

# If on MacOS platform, TMPDIR must be set to be under one of the shared volumes in Docker for Mac
# More info: https://dockstore.org/docs/faq
if sys.platform == "darwin":
tmp_prefix = "tmp_outdir_prefix"
default_mac_path = "/private/tmp/docker_tmp"
if getattr(args, tmp_prefix) and getattr(args, tmp_prefix) == DEFAULT_TMP_PREFIX:
setattr(args, tmp_prefix, default_mac_path)

for dirprefix in ("tmpdir_prefix", "tmp_outdir_prefix", "cachedir"):
if getattr(args, dirprefix) and getattr(args, dirprefix) != 'tmp':
if getattr(args, dirprefix) and getattr(args, dirprefix) != DEFAULT_TMP_PREFIX:
sl = "/" if getattr(args, dirprefix).endswith("/") or dirprefix == "cachedir" else ""
setattr(args, dirprefix,
os.path.abspath(getattr(args, dirprefix)) + sl)
Expand Down