Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
feat!: overhaul slurmdbd charm API part 2
Browse files Browse the repository at this point in the history
Merge pull request #23 from jamesbeedy/small_fixes

Summary of Changes:

- These changes remove the fluentbit relation and associated code and fix some leftover variable references. Additionally, moved the install function to the top of the SlurmdbdManager class.
  • Loading branch information
NucciTheBoss authored Jun 28, 2024
2 parents a2867ba + 21fb324 commit e97669f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 290 deletions.
2 changes: 0 additions & 2 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ links:
requires:
database:
interface: mysql_client
fluentbit:
interface: fluentbit

provides:
slurmctld:
Expand Down
203 changes: 0 additions & 203 deletions lib/charms/fluentbit/v0/fluentbit.py

This file was deleted.

13 changes: 0 additions & 13 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
DatabaseCreatedEvent,
DatabaseRequires,
)
from charms.fluentbit.v0.fluentbit import FluentbitClient
from constants import CHARM_MAINTAINED_PARAMETERS, SLURM_ACCT_DB
from interface_slurmctld import Slurmctld, SlurmctldAvailableEvent, SlurmctldUnavailableEvent
from ops import (
Expand All @@ -22,7 +21,6 @@
CharmBase,
ConfigChangedEvent,
InstallEvent,
RelationCreatedEvent,
StoredState,
UpdateStatusEvent,
WaitingStatus,
Expand All @@ -48,22 +46,16 @@ def __init__(self, *args, **kwargs) -> None:
)

self._db = DatabaseRequires(self, relation_name="database", database_name=SLURM_ACCT_DB)
self._fluentbit = FluentbitClient(self, "fluentbit")
self._slurmdbd_ops_manager = SlurmdbdOpsManager()
self._slurmctld = Slurmctld(self, "slurmctld")

event_handler_bindings = {
# Charm core events
self.on.install: self._on_install,
self.on.update_status: self._on_update_status,
self.on.config_changed: self._write_config_and_restart_slurmdbd,
# Database relation
self._db.on.database_created: self._on_database_created,
# Slurmctld
self._slurmctld.on.slurmctld_available: self._on_slurmctld_available,
self._slurmctld.on.slurmctld_unavailable: self._on_slurmctld_unavailable,
# fluentbit
self.on["fluentbit"].relation_created: self._on_fluentbit_relation_created,
}
for event, handler in event_handler_bindings.items():
self.framework.observe(event, handler)
Expand Down Expand Up @@ -92,11 +84,6 @@ def _on_install(self, event: InstallEvent) -> None:
self.unit.status = ActiveStatus("slurmdbd successfully installed")
self._check_status()

def _on_fluentbit_relation_created(self, event: RelationCreatedEvent) -> None:
"""Set up Fluentbit log forwarding."""
logger.debug("## Configuring fluentbit")
self._fluentbit.configure(self._slurmdbd_ops_manager.fluentbit_config_slurm)

def _on_update_status(self, event: UpdateStatusEvent) -> None:
"""Handle update status."""
self._check_status()
Expand Down
9 changes: 7 additions & 2 deletions src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
"""Constants."""
from pathlib import Path

SLURM_USER = "slurm"
SLURM_GROUP = "slurm"

STATE_DIR = Path("/var/spool/slurmdbd")

CHARM_MAINTAINED_PARAMETERS = {
"DbdPort": "6819",
"AuthType": "auth/munge",
"AuthInfo": '"socket=/var/run/munge/munge.socket.2"',
"SlurmUser": "slurm",
"SlurmUser": SLURM_USER,
"PluginDir": "/usr/lib/x86_64-linux-gnu/slurm-wlm",
"PidFile": "/var/run/slurmdbd.pid",
"LogFile": "/var/log/slurm/slurmdbd.log",
Expand All @@ -18,7 +23,7 @@

SLURMDBD_DEFAULTS_FILE = Path("/etc/default/slurmdbd")

UBUNTU_HPC_PPA_KEY: str = """
UBUNTU_HPC_PPA_KEY = """
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: Hostname:
Version: Hockeypuck 2.1.1-10-gec3b0e7
Expand Down
Loading

0 comments on commit e97669f

Please sign in to comment.