Skip to content

Commit

Permalink
change mount_tmpdir legalese (non-functional)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlin committed Aug 15, 2022
1 parent 30a7448 commit ef5ffee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
13 changes: 8 additions & 5 deletions WDL/runtime/config_templates/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,14 @@ output_hardlinks = false
# output files would be deleted too. Input/output JSON, logs, and stdout/stderr are always retained
# in the task run directory (above the container working directory).
delete_work = false
# In each task container, set TMPDIR environment variable to a subdirectory of the mounted task
# working directory, automatically deleted afterwards. This may be useful if tasks use a lot of
# scratch disk space and the run directory is on larger, separate storage from the container root
# file system holding /tmp. Note the software inside the container must actually use the TMPDIR
# environment variable in order for this to have an effect. (New in v1.5.4)
# Suggest that each task's temporary directory should reside within the mounted task working
# directory, instead of the storage backing the container's root filesystem. The latter (default)
# is usually preferred because the working directory is more likely to reside on slower network-
# attached storage. But mount_tmpdir may be helpful if tasks use large amounts of scratch space and
# the working directory storage has more capacity.
# The exact effect of this setting depends on the container backend implementation: some may change
# where they mount /tmp, some may merely override TMPDIR inside the container, and others may not
# yet implement it at all. (New in v1.5.4)
mount_tmpdir = false
# Selectively mount_tmpdir for those tasks whose names appear in this list. (New in v1.5.4)
mount_tmpdir_for = []
Expand Down
10 changes: 6 additions & 4 deletions WDL/runtime/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,9 @@ def _eval_task_runtime(
if cfg.get_bool("file_io", "mount_tmpdir") or task.name in cfg.get_list(
"file_io", "mount_tmpdir_for"
):
env_vars_override["TMPDIR"] = os.path.join(container.container_dir, "work", "_tmpdir")
env_vars_override["TMPDIR"] = os.path.join(
container.container_dir, "work", "_miniwdl_tmpdir"
)
if env_vars_override:
# usually don't dump values into log, as they may often be auth tokens
logger.notice( # pyre-ignore
Expand Down Expand Up @@ -545,7 +547,7 @@ def _try_task(
):
container.copy_input_files(logger)
host_tmpdir = (
os.path.join(container.host_work_dir(), "_tmpdir")
os.path.join(container.host_work_dir(), "_miniwdl_tmpdir")
if cfg.get_bool("file_io", "mount_tmpdir")
or task.name in cfg.get_list("file_io", "mount_tmpdir_for")
else None
Expand All @@ -554,13 +556,13 @@ def _try_task(
try:
# start container & run command
if host_tmpdir:
logger.debug(_("creating temp directory to mount", TMPDIR=host_tmpdir))
logger.debug(_("creating task temp directory", TMPDIR=host_tmpdir))
os.mkdir(host_tmpdir, mode=0o770)
try:
return container.run(logger, command)
finally:
if host_tmpdir:
logger.info(_("deleting mounted temp directory", TMPDIR=host_tmpdir))
logger.info(_("deleting task temp directory", TMPDIR=host_tmpdir))
rmtree_atomic(host_tmpdir)
if (
"preemptible" in container.runtime_values
Expand Down

0 comments on commit ef5ffee

Please sign in to comment.