Skip to content

Commit 57f4a4f

Browse files
authored
Merge pull request #864 from NVIDIA/am/rm-4931725
Fix path expansion/storage
2 parents efb1234 + 8e7b895 commit 57f4a4f

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/cloudai/_core/installables.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ def installed_path(self) -> Union[str, Path]:
7878
"""Return the cached path or URL of the docker image."""
7979
if self._installed_path:
8080
return self._installed_path.absolute() if isinstance(self._installed_path, Path) else self._installed_path
81+
local_image_path = Path(self.url)
82+
if local_image_path.is_absolute() or self.url.startswith("."):
83+
return local_image_path.absolute()
8184
return self.url
8285

8386
@installed_path.setter

tests/systems/slurm/test_installer.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,3 +368,17 @@ def test_mark_as_installed_local_container(slurm_system: SlurmSystem):
368368
installer.mark_as_installed_one(docker_image)
369369

370370
assert docker_image.installed_path == local_image.absolute()
371+
372+
373+
def test_mark_as_installed_duplicate_local_containers_preserve_local_path(slurm_system: SlurmSystem):
374+
installer = SlurmInstaller(slurm_system)
375+
376+
local_image = Path("/tmp/local_image.sqsh")
377+
first = DockerImage(url=str(local_image))
378+
second = DockerImage(url=str(local_image))
379+
380+
result = installer.mark_as_installed([first, second])
381+
382+
assert result.success
383+
assert first.installed_path == local_image
384+
assert second.installed_path == local_image

0 commit comments

Comments
 (0)