diff --git a/charms/slurmctld/src/slurmctld_ops.py b/charms/slurmctld/src/slurmctld_ops.py index 0a898d7..273159f 100644 --- a/charms/slurmctld/src/slurmctld_ops.py +++ b/charms/slurmctld/src/slurmctld_ops.py @@ -130,7 +130,7 @@ def __init__(self): self._slurmctld_package = CharmedHPCPackageLifecycleManager("slurmctld") def install(self) -> bool: - """Install slurmctld and munge to the system.""" + """Install slurmctld, munge, and common packages to the system.""" if self._slurmctld_package.install() is not True: return False systemd.service_stop("slurmctld") diff --git a/charms/slurmd/src/slurmd_ops.py b/charms/slurmd/src/slurmd_ops.py index 83aa158..3f1afc5 100644 --- a/charms/slurmd/src/slurmd_ops.py +++ b/charms/slurmd/src/slurmd_ops.py @@ -111,6 +111,25 @@ def version(self) -> str: return slurm_package_vers +class CommonPackagesLifecycleManager: + """Facilitate common package lifecycles.""" + + def install(self) -> bool: + """Install package using lib apt.""" + package_installed = False + + try: + apt.update() + apt.add_package(["libpmix-dev", "openmpi-bin"]) + package_installed = True + except apt.PackageNotFoundError: + logger.error("Package not found in package cache or on system.") + except apt.PackageError as e: + logger.error(f"Could not install package. Reason: {e.message}") + + return package_installed + + class SlurmdManager: """SlurmdManager.""" @@ -118,9 +137,14 @@ def __init__(self): self._munge_package = CharmedHPCPackageLifecycleManager("munge") self._slurmd_package = CharmedHPCPackageLifecycleManager("slurmd") self._slurm_client_package = CharmedHPCPackageLifecycleManager("slurm-client") + self._common_packages = CommonPackagesLifecycleManager() def install(self) -> bool: - """Install slurmd, slurm-client and munge packages to the system.""" + """Install slurmd, slurm-client, munge, and common packages to the system.""" + if self._common_packages.install() is not True: + logger.debug("Cannot install common packages.") + return False + if self._slurmd_package.install() is not True: logger.debug("Cannot install 'slurmd' package.") return False