Skip to content

Commit e4684e0

Browse files
authored
slurmctld.Config: defer cgroup,mpi and accounting gather config parsing (PySlurm#372)
Also fix cgroup_config.systemd_timeout parsing
1 parent 2fc4622 commit e4684e0

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

pyslurm/core/slurmctld/config.pxd

+5-6
Original file line numberDiff line numberDiff line change
@@ -1059,12 +1059,11 @@ cdef class Config:
10591059
10601060
{slurm.conf#OPT_X11Parameters}
10611061
"""
1062-
cdef slurm_conf_t *ptr
1063-
1064-
cdef public:
1065-
CgroupConfig cgroup_config
1066-
AccountingGatherConfig accounting_gather_config
1067-
MPIConfig mpi_config
1062+
cdef:
1063+
slurm_conf_t *ptr
1064+
CgroupConfig _cgroup_config
1065+
AccountingGatherConfig _accounting_gather_config
1066+
MPIConfig _mpi_config
10681067

10691068

10701069
# Documentation for the attributes in the MPIConfig class have

pyslurm/core/slurmctld/config.pyx

+23-7
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ cdef class CgroupConfig:
109109

110110
out.mountpoint = conf.get("CgroupMountpoint", "/sys/fs/cgroup")
111111
out.plugin = conf.get("CgroupPlugin", "autodetect")
112-
out.systemd_timeout = int(conf.get("SystemdTimeout", 1000))
112+
113+
systemd_timeout = conf.get("SystemdTimeout", "1000")
114+
out.systemd_timeout = int(systemd_timeout.split(" ")[0])
115+
113116
out.ignore_systemd = _yesno_to_bool(conf.get("IgnoreSystemd"))
114117
out.ignore_systemd_on_failure = _yesno_to_bool(conf.get("IgnoreSystemdOnFailure"))
115118
out.enable_controllers = _yesno_to_bool(conf.get("EnableControllers"))
@@ -205,13 +208,7 @@ cdef class Config:
205208
"""
206209
cdef Config conf = Config.__new__(Config)
207210
verify_rpc(slurm_load_ctl_conf(0, &conf.ptr))
208-
209-
conf.cgroup_config = CgroupConfig.from_ptr(conf.ptr.cgroup_conf)
210-
conf.accounting_gather_config = AccountingGatherConfig.from_ptr(
211-
conf.ptr.acct_gather_conf)
212-
conf.mpi_config = MPIConfig.from_ptr(conf.ptr.mpi_conf)
213211
# TODO: node_features_conf
214-
215212
return conf
216213

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

231+
@property
232+
def cgroup_config(self):
233+
if not self._cgroup_config:
234+
self._cgroup_config = CgroupConfig.from_ptr(self.ptr.cgroup_conf)
235+
return self._cgroup_config
236+
237+
@property
238+
def accounting_gather_config(self):
239+
if not self._accounting_gather_config:
240+
self._accounting_gather_config = AccountingGatherConfig.from_ptr(
241+
self.ptr.acct_gather_conf)
242+
return self._accounting_gather_config
243+
244+
@property
245+
def mpi_config(self):
246+
if not self._mpi_config:
247+
self._mpi_config = MPIConfig.from_ptr(self.ptr.mpi_conf)
248+
return self._mpi_config
249+
234250
@property
235251
def accounting_storage_enforce(self):
236252
cdef char tmp[128]

0 commit comments

Comments
 (0)