Skip to content

Commit 35c3594

Browse files
committed
Fix installation logic for File on k8s
1 parent 3f0d873 commit 35c3594

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/cloudai/systems/kubernetes/kubernetes_installer.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ def is_installed_one(self, item: Installable) -> InstallStatusResult:
118118
return InstallStatusResult(False, f"Git repository {item.url} not cloned")
119119
elif isinstance(item, PythonExecutable):
120120
return self._is_python_executable_installed(item)
121+
elif isinstance(item, File):
122+
if item.installed_path and item.installed_path.exists():
123+
return InstallStatusResult(True)
124+
return InstallStatusResult(False, f"File {item.installed_path} does not exist.")
121125
elif isinstance(item, HFModel):
122126
return self.hf_model_manager.is_model_downloaded(item)
123127
return InstallStatusResult(False, f"Unsupported item type: {type(item)}")
@@ -132,6 +136,9 @@ def mark_as_installed_one(self, item: Installable) -> InstallStatusResult:
132136
item.git_repo.installed_path = self.system.install_path / item.git_repo.repo_name
133137
item.venv_path = self.system.install_path / item.venv_name
134138
return InstallStatusResult(True)
139+
elif isinstance(item, File):
140+
item.installed_path = self.system.install_path / item.src.name
141+
return InstallStatusResult(True)
135142
elif isinstance(item, HFModel):
136143
item.installed_path = self.system.hf_home_path # fake path is OK here as the whole HF home will be mounted
137144
return InstallStatusResult(True)

tests/test_base_installer.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,7 @@ def test_check_supported(installer: KubernetesInstaller | SlurmInstaller):
331331
installer.hf_model_manager = Mock()
332332

333333
git = GitRepo(url="./git_url", commit="commit_hash")
334-
items = [DockerImage("fake_url/img"), PythonExecutable(git), HFModel("model_name")]
335-
if isinstance(installer, SlurmInstaller):
336-
items.append(File(Path(__file__)))
334+
items = [DockerImage("fake_url/img"), PythonExecutable(git), HFModel("model_name"), File(Path(__file__))]
337335
for item in items:
338336
res = installer.install_one(item)
339337
assert res.success, f"Failed to install {item} for {installer.__class__.__name__=} {res.message=}"

0 commit comments

Comments
 (0)