Skip to content

slurmctld.Config: defer cgroup,mpi and accounting gather config parsing #372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions pyslurm/core/slurmctld/config.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -1059,12 +1059,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
Loading