Skip to content

Commit

Permalink
Fix MLCube execution when paths contain spaces (#588)
Browse files Browse the repository at this point in the history
* Bump mlcube version

* Enclose cube path in quotes

* Fix tests
  • Loading branch information
aristizabal95 authored May 3, 2024
1 parent 48f1fb1 commit 0808473
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cli/medperf/entities/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def run(
"""
kwargs.update(string_params)
cmd = f"mlcube --log-level {config.loglevel} run"
cmd += f" --mlcube={self.cube_path} --task={task} --platform={config.platform} --network=none"
cmd += f" --mlcube=\"{self.cube_path}\" --task={task} --platform={config.platform} --network=none"
if config.gpus is not None:
cmd += f" --gpus={config.gpus}"
if read_protected_input:
Expand Down
8 changes: 4 additions & 4 deletions cli/medperf/tests/entities/test_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def test_cube_runs_command(self, mocker, timeout, setup, task):
)
mocker.patch(PATCH_CUBE.format("Cube.get_config"), side_effect=["", ""])
expected_cmd = (
f"mlcube --log-level debug run --mlcube={self.manifest_path} --task={task} "
f"mlcube --log-level debug run --mlcube=\"{self.manifest_path}\" --task={task} "
+ f"--platform={self.platform} --network=none --mount=ro"
+ ' -Pdocker.cpu_args="-u $(id -u):$(id -g)"'
+ ' -Pdocker.gpu_args="-u $(id -u):$(id -g)"'
Expand All @@ -207,7 +207,7 @@ def test_cube_runs_command_with_rw_access(self, mocker, setup, task):
side_effect=["", ""],
)
expected_cmd = (
f"mlcube --log-level debug run --mlcube={self.manifest_path} --task={task} "
f"mlcube --log-level debug run --mlcube=\"{self.manifest_path}\" --task={task} "
+ f"--platform={self.platform} --network=none"
+ ' -Pdocker.cpu_args="-u $(id -u):$(id -g)"'
+ ' -Pdocker.gpu_args="-u $(id -u):$(id -g)"'
Expand All @@ -229,7 +229,7 @@ def test_cube_runs_command_with_extra_args(self, mocker, setup, task):
)
mocker.patch(PATCH_CUBE.format("Cube.get_config"), side_effect=["", ""])
expected_cmd = (
f"mlcube --log-level debug run --mlcube={self.manifest_path} --task={task} "
f"mlcube --log-level debug run --mlcube=\"{self.manifest_path}\" --task={task} "
+ f'--platform={self.platform} --network=none --mount=ro test="test"'
+ ' -Pdocker.cpu_args="-u $(id -u):$(id -g)"'
+ ' -Pdocker.gpu_args="-u $(id -u):$(id -g)"'
Expand All @@ -254,7 +254,7 @@ def test_cube_runs_command_and_preserves_runtime_args(self, mocker, setup, task)
side_effect=["cpuarg cpuval", "gpuarg gpuval"],
)
expected_cmd = (
f"mlcube --log-level debug run --mlcube={self.manifest_path} --task={task} "
f"mlcube --log-level debug run --mlcube=\"{self.manifest_path}\" --task={task} "
+ f"--platform={self.platform} --network=none --mount=ro"
+ ' -Pdocker.cpu_args="cpuarg cpuval -u $(id -u):$(id -g)"'
+ ' -Pdocker.gpu_args="gpuarg gpuval -u $(id -u):$(id -g)"'
Expand Down
6 changes: 3 additions & 3 deletions cli/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ colorama==0.4.4
time-machine==2.4.0
pytest-mock==1.13.0
pyfakefs==5.0.0
mlcube @ git+https://github.com/hasan7n/mlcube@11632a85064f653e6c5a59e3c6a4996ab9fe510b#subdirectory=mlcube
mlcube-docker @ git+https://github.com/hasan7n/mlcube@11632a85064f653e6c5a59e3c6a4996ab9fe510b#subdirectory=runners/mlcube_docker
mlcube-singularity @ git+https://github.com/hasan7n/mlcube@11632a85064f653e6c5a59e3c6a4996ab9fe510b#subdirectory=runners/mlcube_singularity
mlcube @ git+https://github.com/hasan7n/mlcube@7fbb1828c9c79ab52023d2919e157468deecb95a#subdirectory=mlcube
mlcube-docker @ git+https://github.com/hasan7n/mlcube@7fbb1828c9c79ab52023d2919e157468deecb95a#subdirectory=runners/mlcube_docker
mlcube-singularity @ git+https://github.com/hasan7n/mlcube@7fbb1828c9c79ab52023d2919e157468deecb95a#subdirectory=runners/mlcube_singularity
validators==0.18.2
merge-args==0.1.4
synapseclient==4.1.1
Expand Down

0 comments on commit 0808473

Please sign in to comment.