Skip to content

Commit

Permalink
Remove redundant --contain switch
Browse files Browse the repository at this point in the history
  • Loading branch information
rhpvorderman committed Jul 31, 2024
1 parent 4c5a860 commit 74e5612
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion lib/galaxy/tool_util/deps/container_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,6 @@ def containerize_command(self, command: str) -> str:
cleanenv=asbool(self.prop("cleanenv", singularity_util.DEFAULT_CLEANENV)),
ipc=asbool(self.prop("ipc", singularity_util.DEFAULT_IPC)),
pid=asbool(self.prop("pid", singularity_util.DEFAULT_PID)),
contain=asbool(self.prop("contain", singularity_util.DEFAULT_CONTAIN)),
mount_home=asbool(self.prop("mount_home", singularity_util.DEFAULT_MOUNT_HOME)),
no_mount=self.prop("no_mount", singularity_util.DEFAULT_NO_MOUNT),
**self.get_singularity_target_kwds(),
Expand Down
9 changes: 5 additions & 4 deletions lib/galaxy/tool_util/deps/singularity_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# the ipc namespace, this fixes some issues with python multiprocessing.
# --cleanenv makes sure the current environment is not inherited.
DEFAULT_CLEANENV = True
DEFAULT_CONTAIN = True
DEFAULT_IPC = True
DEFAULT_PID = True
DEFAULT_MOUNT_HOME = False
Expand Down Expand Up @@ -84,7 +83,6 @@ def build_singularity_run_command(
cleanenv: bool = DEFAULT_CLEANENV,
ipc: bool = DEFAULT_IPC,
pid: bool = DEFAULT_PID,
contain: bool = DEFAULT_CONTAIN,
mount_home: bool = DEFAULT_MOUNT_HOME,
no_mount: Optional[List[str]] = DEFAULT_NO_MOUNT,
) -> str:
Expand All @@ -104,6 +102,11 @@ def build_singularity_run_command(
)
command_parts.append("-s")
command_parts.append("exec")
# Singularity mounts some directories, such as $HOME and $PWD by default.
# using --contain disables this behaviour and only allows explicitly
# requested volumes to be mounted. Since galaxy already mounts $PWD and
# mount_home can be activated, a switch for --contain is redundant.
command_parts.append("--contain")
if working_directory:
command_parts.extend(["--pwd", working_directory])
if cleanenv:
Expand All @@ -112,8 +115,6 @@ def build_singularity_run_command(
command_parts.append("--ipc")
if pid:
command_parts.append("--pid")
if contain:
command_parts.append("--contain")
if no_mount:
command_parts.extend(["--no-mount", ",".join(no_mount)])
for volume in volumes:
Expand Down

0 comments on commit 74e5612

Please sign in to comment.