1616
1717import logging
1818
19- from cloudai import BaseInstaller , DockerImage , File , GitRepo , Installable , InstallStatusResult , PythonExecutable
19+ from cloudai import (
20+ BaseInstaller ,
21+ DockerImage ,
22+ File ,
23+ GitRepo ,
24+ Installable ,
25+ InstallStatusResult ,
26+ PythonExecutable ,
27+ )
2028from cloudai .installer .slurm_installer import SlurmInstaller
2129from cloudai .systems import LSFSystem
2230
2331
2432class LSFInstaller (BaseInstaller ):
25- """
26- Installer for systems that use the LSF scheduler.
27-
28- Handles the installation of benchmarks or test templates for LSF-managed systems.
29-
30- Attributes:
31- PREREQUISITES (List[str]): A list of required binaries for the installer.
32- install_path (Path): Path where the benchmarks are to be installed.
33- """
33+ """Installer for LSF systems."""
3434
3535 PREREQUISITES = ("bsub" , "bjobs" , "bhosts" , "lsid" , "lsload" )
3636
3737 def __init__ (self , system : LSFSystem ):
38- """
39- Initialize the LSFInstaller with a system object.
40-
41- Args:
42- system (LSFSystem): The system schema object.
43- """
4438 super ().__init__ (system )
4539 self .system = system
4640
4741 @property
4842 def slurm_installer (self ) -> SlurmInstaller :
49- """
50- Lazily initialize and return a SlurmInstaller instance.
51-
52- Returns:
53- SlurmInstaller: The SlurmInstaller instance.
54- """
5543 if not hasattr (self , "_slurm_installer" ):
5644 from cloudai .systems import SlurmSystem
5745
@@ -61,12 +49,6 @@ def slurm_installer(self) -> SlurmInstaller:
6149 return self ._slurm_installer
6250
6351 def _check_prerequisites (self ) -> InstallStatusResult :
64- """
65- Check for the presence of required binaries, raising an error if any are missing.
66-
67- Returns:
68- InstallStatusResult: Result containing the status and any error message.
69- """
7052 base_prerequisites_result = super ()._check_prerequisites ()
7153 if not base_prerequisites_result .success :
7254 return InstallStatusResult (False , base_prerequisites_result .message )
@@ -78,21 +60,11 @@ def _check_prerequisites(self) -> InstallStatusResult:
7860 return InstallStatusResult (False , str (e ))
7961
8062 def _check_required_binaries (self ) -> None :
81- """Check for the presence of required binaries, raising an error if any are missing."""
8263 for binary in self .PREREQUISITES :
8364 if not self ._is_binary_installed (binary ):
8465 raise EnvironmentError (f"Required binary '{ binary } ' is not installed." )
8566
8667 def install_one (self , item : Installable ) -> InstallStatusResult :
87- """
88- Install a single item.
89-
90- Args:
91- item (Installable): The item to install.
92-
93- Returns:
94- InstallStatusResult: Result containing the installation status and error message if any.
95- """
9668 logging .debug (f"Attempt to install { item } " )
9769
9870 if isinstance (item , DockerImage ):
@@ -108,15 +80,6 @@ def install_one(self, item: Installable) -> InstallStatusResult:
10880 return InstallStatusResult (False , f"Unsupported item type: { type (item )} " )
10981
11082 def uninstall_one (self , item : Installable ) -> InstallStatusResult :
111- """
112- Uninstall a single item.
113-
114- Args:
115- item (Installable): The item to uninstall.
116-
117- Returns:
118- InstallStatusResult: Result containing the uninstallation status and error message if any.
119- """
12083 logging .debug (f"Attempt to uninstall { item !r} " )
12184 if isinstance (item , PythonExecutable ):
12285 return self .slurm_installer ._uninstall_python_executable (item )
@@ -128,15 +91,6 @@ def uninstall_one(self, item: Installable) -> InstallStatusResult:
12891 return InstallStatusResult (False , f"Unsupported item type: { type (item )} " )
12992
13093 def is_installed_one (self , item : Installable ) -> InstallStatusResult :
131- """
132- Check if a single item is installed.
133-
134- Args:
135- item (Installable): The item to check.
136-
137- Returns:
138- InstallStatusResult: Result containing the installation status and error message if any.
139- """
14094 if isinstance (item , DockerImage ):
14195 logging .info (f"Skipping installation check for Docker image { item } in LSF system." )
14296 return InstallStatusResult (True , "Docker image installation skipped for LSF system." )
@@ -150,15 +104,5 @@ def is_installed_one(self, item: Installable) -> InstallStatusResult:
150104 return InstallStatusResult (False , f"Unsupported item type: { type (item )} " )
151105
152106 def mark_as_installed_one (self , item : Installable ) -> InstallStatusResult :
153- """
154- Mark a single item as installed.
155-
156- Args:
157- item (Installable): The item to mark as installed.
158-
159- Returns:
160- InstallStatusResult: Result containing the status and error message if any.
161- """
162107 logging .debug (f"Marking { item !r} as installed." )
163-
164108 return self .slurm_installer .mark_as_installed_one (item )
0 commit comments