Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/cloudai/systems/kubernetes/kubernetes_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ def is_installed_one(self, item: Installable) -> InstallStatusResult:
return InstallStatusResult(False, f"Git repository {item.url} not cloned")
elif isinstance(item, PythonExecutable):
return self._is_python_executable_installed(item)
elif isinstance(item, File):
if item.installed_path and item.installed_path.exists():
return InstallStatusResult(True)
return InstallStatusResult(False, f"File {item.installed_path} does not exist.")
elif isinstance(item, HFModel):
return self.hf_model_manager.is_model_downloaded(item)
return InstallStatusResult(False, f"Unsupported item type: {type(item)}")
Expand All @@ -132,6 +136,9 @@ def mark_as_installed_one(self, item: Installable) -> InstallStatusResult:
item.git_repo.installed_path = self.system.install_path / item.git_repo.repo_name
item.venv_path = self.system.install_path / item.venv_name
return InstallStatusResult(True)
elif isinstance(item, File):
item.installed_path = self.system.install_path / item.src.name
return InstallStatusResult(True)
elif isinstance(item, HFModel):
item.installed_path = self.system.hf_home_path # fake path is OK here as the whole HF home will be mounted
return InstallStatusResult(True)
Expand Down
4 changes: 1 addition & 3 deletions tests/test_base_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,7 @@ def test_check_supported(installer: KubernetesInstaller | SlurmInstaller):
installer.hf_model_manager = Mock()

git = GitRepo(url="./git_url", commit="commit_hash")
items = [DockerImage("fake_url/img"), PythonExecutable(git), HFModel("model_name")]
if isinstance(installer, SlurmInstaller):
items.append(File(Path(__file__)))
items = [DockerImage("fake_url/img"), PythonExecutable(git), HFModel("model_name"), File(Path(__file__))]
for item in items:
res = installer.install_one(item)
assert res.success, f"Failed to install {item} for {installer.__class__.__name__=} {res.message=}"
Expand Down
Loading