From 74e5612742060bd28b75d7ff5aa9b4c55bb0b4ec Mon Sep 17 00:00:00 2001 From: Ruben Vorderman Date: Wed, 31 Jul 2024 09:11:43 +0200 Subject: [PATCH] Remove redundant --contain switch --- lib/galaxy/tool_util/deps/container_classes.py | 1 - lib/galaxy/tool_util/deps/singularity_util.py | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/tool_util/deps/container_classes.py b/lib/galaxy/tool_util/deps/container_classes.py index 8891c95af830..55acaae81b86 100644 --- a/lib/galaxy/tool_util/deps/container_classes.py +++ b/lib/galaxy/tool_util/deps/container_classes.py @@ -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(), diff --git a/lib/galaxy/tool_util/deps/singularity_util.py b/lib/galaxy/tool_util/deps/singularity_util.py index ebeb9922329e..1eee5abdb74f 100644 --- a/lib/galaxy/tool_util/deps/singularity_util.py +++ b/lib/galaxy/tool_util/deps/singularity_util.py @@ -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 @@ -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: @@ -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: @@ -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: