Skip to content
Permalink
Browse files
fix: Only --bind Snakemake when we're working with a Python script (#…
…1206)

Co-authored-by: Johannes Köster <johannes.koester@uni-due.de>
  • Loading branch information
frankier and johanneskoester committed Oct 21, 2021
1 parent 84d1f64 commit 1d79f625b7262d66def71c779f2a2c091bc418d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
@@ -113,6 +113,7 @@ def shellcmd(
envvars=None,
shell_executable=None,
container_workdir=None,
is_python_script=False,
):
"""Execute shell command inside singularity container given optional args
and environment variables to be passed."""
@@ -131,8 +132,9 @@ def shellcmd(
# because we cannot be sure where it is located in the container.
shell_executable = os.path.split(shell_executable)[-1]

# mount host snakemake module into container
args += " --bind {}:{}".format(SNAKEMAKE_SEARCHPATH, SNAKEMAKE_MOUNTPOINT)
if is_python_script:
# mount host snakemake module into container
args += " --bind {}:{}".format(SNAKEMAKE_SEARCHPATH, SNAKEMAKE_MOUNTPOINT)

if container_workdir:
args += " --pwd {}".format(container_workdir)
@@ -579,7 +579,9 @@ def execute_script(self, fname, edit=False):
# bash is configured as executable on Windows
py_exec = py_exec.replace("\\", "/")
# use the same Python as the running process or the one from the environment
self._execute_cmd("{py_exec} {fname:q}", py_exec=py_exec, fname=fname)
self._execute_cmd(
"{py_exec} {fname:q}", py_exec=py_exec, fname=fname, is_python_script=True
)


class RScript(ScriptBase):
@@ -184,6 +184,7 @@ def __new__(
envvars=None,
shell_executable=cls._process_args["executable"],
container_workdir=shadow_dir,
is_python_script=context.get("is_python_script", False),
)
logger.info("Activating singularity image {}".format(container_img))
if conda_env:

0 comments on commit 1d79f62

Please sign in to comment.