From ba550099e4d780d33e13d0b0b80c75ed598424c7 Mon Sep 17 00:00:00 2001
From: PGijsbers
Date: Thu, 12 Dec 2024 20:30:57 +0200
Subject: [PATCH] Quote mount paths to allow presence of whitespace
---
amlb/runners/docker.py | 4 ++--
amlb/runners/singularity.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/amlb/runners/docker.py b/amlb/runners/docker.py
index d74c9c51d..4630f23d1 100644
--- a/amlb/runners/docker.py
+++ b/amlb/runners/docker.py
@@ -48,7 +48,7 @@ def _script(self):
return os.path.join(self._framework_dir, _setup_dir_, "Dockerfile")
def _start_container(self, script_params=""):
- """Implementes the container run method"""
+ """Invokes the container run method"""
in_dir = rconfig().input_dir
out_dir = rconfig().output_dir
custom_dir = rconfig().user_dir
@@ -60,7 +60,7 @@ def _start_container(self, script_params=""):
inst_name = f"{self.sid}.{str_sanitize(str_digest(script_params))}"
cmd = (
"docker run --name {name} {options} {run_as} "
- "-v {input}:/input -v {output}:/output -v {custom}:/custom "
+ "-v '{input}':/input -v '{output}':/output -v '{custom}':/custom "
"--rm {image} {params} -i /input -o /output -u /custom -s skip -Xrun_mode=docker {extra_params}"
).format(
name=inst_name,
diff --git a/amlb/runners/singularity.py b/amlb/runners/singularity.py
index 1190aac12..1f51afd6f 100644
--- a/amlb/runners/singularity.py
+++ b/amlb/runners/singularity.py
@@ -68,7 +68,7 @@ def _script(self):
return os.path.join(self._framework_dir, _setup_dir_, "Singularityfile")
def _start_container(self, script_params=""):
- """Implementes the container run method"""
+ """Invokes the container run method"""
in_dir = rconfig().input_dir
out_dir = rconfig().output_dir
custom_dir = rconfig().user_dir
@@ -77,7 +77,7 @@ def _start_container(self, script_params=""):
script_extra_params = "--session=" # in combination with `self.output_dirs.session` usage below to prevent creation of 2 sessions locally
cmd = (
"singularity run --pwd /bench {options} "
- "-B {input}:/input -B {output}:/output -B {custom}:/custom "
+ "-B '{input}':/input -B '{output}':/output -B '{custom}':/custom "
'{image} "{params} -i /input -o /output -u /custom -s skip -Xrun_mode=singularity {extra_params}"'
).format(
options=rconfig().singularity.run_extra_options,