HPC Libs

  • José Julián Espina Del Ángel
Channel Revision Published Runs on
latest/stable 1 03 Jul 2024
Ubuntu 22.04
juju deploy hpc-libs
Show information

Platform:

Ubuntu
22.04

charms.hpc_libs.v0.slurm_ops

Abstractions for managing Slurm operations via snap or systemd.

This library contains manager classes that provide high-level interfaces for managing Slurm operations within charmed operators.

Note

This charm library depends on the charms.operator_libs_linux.v0.apt charm library, which can be imported by running charmcraft fetch-lib charms.operator_libs_linux.v0.apt.

Example Usage
Managing the slurmctld service

The SlurmctldManager class manages the operations of the Slurm controller service. You can pass the boolean keyword argument snap=True or snap=False to instruct SlurmctldManager to either use the Slurm snap package or Debian package respectively.

from charms.hpc_libs.v0.slurm_ops import SlurmctldManager


class ApplicationCharm(CharmBase):
    # Application charm that needs to use the Slurm snap.

    def __init__(self, *args, **kwargs) -> None:
        super().__init__(*args, **kwargs)
        self._slurm_manager = SlurmctldManager(snap=True)
        self.framework.observe(self.on.install, self._on_install)

    def _on_install(self, _) -> None:
        self._slurmctld.install()
        self.unit.set_workload_version(self._slurmctld.version())
        with self._slurmctld.config() as config:
            config.cluster_name = "cluster"

class SlurmOpsError

Description

Exception raised when a slurm operation failed. None

Methods

SlurmOpsError. message( self )

Description

Return message passed as argument to exception. None

class SlurmctldManager

Description

Manager for the Slurmctld service. None

Methods

SlurmctldManager. __init__( self )

class SlurmdManager

Manager for the Slurmd service.

Description

This service will additionally provide some environment variables that need to be passed through to the service in case the default service is overriden (e.g. a systemctl file override).

- SLURMD_CONFIG_SERVER. Sets the `--conf-server` option for `slurmd`.

Methods

SlurmdManager. __init__( self )

SlurmdManager. user( self )

Description

Get the SlurmdUser. None

SlurmdManager. group( self )

Description

Get the SlurmdUser group. None

SlurmdManager. config_server( self )

Description

Get the config server address of this Slurmd node. None

SlurmdManager. config_server( self , addr: str )

Description

Set the config server address of this Slurmd node. None

SlurmdManager. config_server( self )

Description

Unset the config server address of this Slurmd node. None

class SlurmdbdManager

Description

Manager for the Slurmdbd service. None

Methods

SlurmdbdManager. __init__( self )

SlurmdbdManager. mysql_unix_port( self )

Description

Get the URI of the unix socket slurmdbd uses to communicate with MySQL. None

SlurmdbdManager. mysql_unix_port( self , socket_path )

Description

Set the unix socket URI that slurmdbd will use to communicate with MySQL. None

SlurmdbdManager. mysql_unix_port( self )

Description

Delete the configured unix socket URI. None

class SlurmrestdManager

Description

Manager for the Slurmrestd service. None

Methods

SlurmrestdManager. __init__( self )

SlurmrestdManager. user( self )

Description

Get the user that the slurmrestd service will run as. None

SlurmrestdManager. group( self )

Description

Get the group that the slurmrestd service will run as. None