Skip to content

Commit

Permalink
feat(slurmd,slurmctld): Add common packages to slurmd and slurmctld (#24
Browse files Browse the repository at this point in the history
)

* feat(slurmd,slurmctld): add common packages

These changes install nfs-common, openmpi-bin, and libpmix-dev to
slurmd and nfs-common to slurmctld.

Fixes: #23
  • Loading branch information
jamesbeedy authored Sep 5, 2024
1 parent 4ddc566 commit 232d4c0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charms/slurmctld/src/slurmctld_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
26 changes: 25 additions & 1 deletion charms/slurmd/src/slurmd_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,40 @@ 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."""

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
Expand Down

0 comments on commit 232d4c0

Please sign in to comment.