Skip to content

Commit

Permalink
slurmctld.Config: defer cgroup,mpi and accounting gather config parsi…
Browse files Browse the repository at this point in the history
…ng (#372)

Also fix cgroup_config.systemd_timeout parsing

(cherry picked from commit e4684e0)
  • Loading branch information
tazend committed Feb 2, 2025
1 parent e7ebb86 commit b7db1dd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
11 changes: 5 additions & 6 deletions pyslurm/core/slurmctld/config.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -1058,12 +1058,11 @@ cdef class Config:
{slurm.conf#OPT_X11Parameters}
"""
cdef slurm_conf_t *ptr

cdef public:
CgroupConfig cgroup_config
AccountingGatherConfig accounting_gather_config
MPIConfig mpi_config
cdef:
slurm_conf_t *ptr
CgroupConfig _cgroup_config
AccountingGatherConfig _accounting_gather_config
MPIConfig _mpi_config


# Documentation for the attributes in the MPIConfig class have
Expand Down
30 changes: 23 additions & 7 deletions pyslurm/core/slurmctld/config.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ cdef class CgroupConfig:

out.mountpoint = conf.get("CgroupMountpoint", "/sys/fs/cgroup")
out.plugin = conf.get("CgroupPlugin", "autodetect")
out.systemd_timeout = int(conf.get("SystemdTimeout", 1000))

systemd_timeout = conf.get("SystemdTimeout", "1000")
out.systemd_timeout = int(systemd_timeout.split(" ")[0])

out.ignore_systemd = _yesno_to_bool(conf.get("IgnoreSystemd"))
out.ignore_systemd_on_failure = _yesno_to_bool(conf.get("IgnoreSystemdOnFailure"))
out.enable_controllers = _yesno_to_bool(conf.get("EnableControllers"))
Expand Down Expand Up @@ -205,13 +208,7 @@ cdef class Config:
"""
cdef Config conf = Config.__new__(Config)
verify_rpc(slurm_load_ctl_conf(0, &conf.ptr))

conf.cgroup_config = CgroupConfig.from_ptr(conf.ptr.cgroup_conf)
conf.accounting_gather_config = AccountingGatherConfig.from_ptr(
conf.ptr.acct_gather_conf)
conf.mpi_config = MPIConfig.from_ptr(conf.ptr.mpi_conf)
# TODO: node_features_conf

return conf

def to_dict(self):
Expand All @@ -231,6 +228,25 @@ cdef class Config:
out["mpi_config"] = self.mpi_config.to_dict()
return out

@property
def cgroup_config(self):
if not self._cgroup_config:
self._cgroup_config = CgroupConfig.from_ptr(self.ptr.cgroup_conf)
return self._cgroup_config

@property
def accounting_gather_config(self):
if not self._accounting_gather_config:
self._accounting_gather_config = AccountingGatherConfig.from_ptr(
self.ptr.acct_gather_conf)
return self._accounting_gather_config

@property
def mpi_config(self):
if not self._mpi_config:
self._mpi_config = MPIConfig.from_ptr(self.ptr.mpi_conf)
return self._mpi_config

@property
def accounting_storage_enforce(self):
cdef char tmp[128]
Expand Down

0 comments on commit b7db1dd

Please sign in to comment.