Skip to content

Commit 3f20d07

Browse files
authored
Slurm 25.05 compatibility (#387)
* update node.pyx for 25.05 * remove unusued defines * change prolog_epilog_timeout to prolog_timeout and epilog_timeout * remove lft and rgt from association * update definitions for structs necessary to get batch script * regenerate slurm headers for 25.05 * slurm_get_select_nodeinfo is removed * remove some long deprecated classes/functions in deprecated.pyx All of these classes have better replacements * bump version to 25.5.0 * slurmctld: update docs for the prolog/epilog timeout member change * update all references of 24.11 to 25.05 (except changelog for now)
1 parent 546f3d2 commit 3f20d07

File tree

18 files changed

+260
-1832
lines changed

18 files changed

+260
-1832
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ pyslurm is the Python client library for the [Slurm Workload Manager](https://sl
88
* [Python](https://www.python.org) - >= 3.6
99
* [Cython](https://cython.org) - >= 0.29.37
1010

11-
This Version is for Slurm 24.11.x
11+
This Version is for Slurm 25.05.x
1212

1313
## Versioning
1414

1515
In pyslurm, the versioning scheme follows the official Slurm versioning. The
1616
first two numbers (`MAJOR.MINOR`) always correspond to Slurms Major-Release,
17-
for example `24.11`.
17+
for example `25.05`.
1818
The last number (`MICRO`) is however not tied in any way to Slurms `MICRO`
1919
version, but is instead PySlurm's internal Patch-Level. For example, any
20-
pyslurm 24.11.X version should work with any Slurm 24.11.X release.
20+
pyslurm 25.05.X version should work with any Slurm 25.05.X release.
2121

2222
## Installation
2323

@@ -29,8 +29,8 @@ the corresponding paths to the necessary files.
2929
You can specify those with environment variables (recommended), for example:
3030

3131
```shell
32-
export SLURM_INCLUDE_DIR=/opt/slurm/24.11/include
33-
export SLURM_LIB_DIR=/opt/slurm/24.11/lib
32+
export SLURM_INCLUDE_DIR=/opt/slurm/25.05/include
33+
export SLURM_LIB_DIR=/opt/slurm/25.05/lib
3434
```
3535

3636
Then you can proceed to install pyslurm, for example by cloning the Repository:

pyslurm.spec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%define python3_pkgversion 3.11
22

33
Name: python-pyslurm
4-
Version: 24.11.0
4+
Version: 25.5.0
55
%define rel 1
66
Release: %{rel}%{?dist}
77
Summary: Python interface to Slurm
@@ -15,8 +15,8 @@ BuildRequires: python%{python3_pkgversion}-wheel
1515
BuildRequires: python%{python3_pkgversion}-Cython
1616
BuildRequires: python%{python3_pkgversion}-packaging
1717
BuildRequires: python-rpm-macros
18-
BuildRequires: slurm-devel >= 24.11.0
19-
BuildRequires: slurm >= 24.11.0
18+
BuildRequires: slurm-devel >= 25.05.0
19+
BuildRequires: slurm >= 25.05.0
2020
Requires: python%{python3_pkgversion}
2121

2222
%description

pyslurm/core/node.pxd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ from pyslurm.slurm cimport (
4343
slurm_free_node_info_members,
4444
slurm_free_update_node_msg,
4545
slurm_free_partition_info_msg,
46-
slurm_get_select_nodeinfo,
4746
slurm_sprint_cpu_bind_type,
4847
slurm_node_state_string_complete,
4948
slurm_node_state_string,

pyslurm/core/node.pyx

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -507,14 +507,7 @@ cdef class Node:
507507

508508
@property
509509
def allocated_memory(self):
510-
cdef uint64_t alloc_memory = 0
511-
if self.info.select_nodeinfo:
512-
slurm_get_select_nodeinfo(
513-
self.info.select_nodeinfo,
514-
slurm.SELECT_NODEDATA_MEM_ALLOC,
515-
slurm.NODE_STATE_ALLOCATED,
516-
&alloc_memory)
517-
return alloc_memory
510+
return u64_parse(self.info.alloc_memory, on_noval=0)
518511

519512
@property
520513
def real_memory(self):
@@ -547,7 +540,7 @@ cdef class Node:
547540

548541
@property
549542
def effective_cpus(self):
550-
return u16_parse(self.info.cpus_efctv)
543+
return u16_parse(self.info.cpus_efctv, on_noval=0)
551544

552545
@property
553546
def total_cpus(self):
@@ -616,35 +609,15 @@ cdef class Node:
616609

617610
@property
618611
def allocated_tres(self):
619-
cdef char *alloc_tres = NULL
620-
if self.info.select_nodeinfo:
621-
slurm_get_select_nodeinfo(
622-
self.info.select_nodeinfo,
623-
slurm.SELECT_NODEDATA_TRES_ALLOC_FMT_STR,
624-
slurm.NODE_STATE_ALLOCATED,
625-
&alloc_tres
626-
)
627-
return cstr.to_dict(alloc_tres)
612+
return cstr.to_dict(self.info.alloc_tres_fmt_str)
628613

629614
@property
630615
def allocated_cpus(self):
631-
cdef uint16_t alloc_cpus = 0
632-
if self.info.select_nodeinfo:
633-
slurm_get_select_nodeinfo(
634-
self.info.select_nodeinfo,
635-
slurm.SELECT_NODEDATA_SUBCNT,
636-
slurm.NODE_STATE_ALLOCATED,
637-
&alloc_cpus
638-
)
639-
return alloc_cpus
616+
return u16_parse(self.info.alloc_cpus, on_noval=0)
640617

641618
@property
642619
def idle_cpus(self):
643-
efctv = self.effective_cpus
644-
if not efctv:
645-
return None
646-
647-
return efctv - self.allocated_cpus
620+
return self.effective_cpus - self.allocated_cpus
648621

649622
@property
650623
def cpu_binding(self):

pyslurm/core/slurmctld/config.pxd

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,11 @@ cdef class Config:
285285
node when a Job completes.
286286
287287
{slurm.conf#OPT_Epilog}
288+
epilog_timeout (int):
289+
The interval in seconds Slurm waits for Epilog before terminating
290+
them.
291+
292+
{slurm.conf#OPT_EpilogTimeout}
288293
epilog_msg_time (int):
289294
The number of microseconds that the slurmctld daemon requires to
290295
process an epilog completion message from the slurmd daemons.
@@ -672,11 +677,11 @@ cdef class Config:
672677
it is asked to run a job step from a new job allocation.
673678
674679
{slurm.conf#OPT_Prolog}
675-
prolog_epilog_timeout (int):
680+
prolog_timeout (int):
676681
The interval in seconds Slurm waits for Prolog and Epilog before
677682
terminating them.
678683
679-
{slurm.conf#OPT_PrologEpilogTimeout}
684+
{slurm.conf#OPT_PrologTimeout}
680685
prolog_slurmctld (list[str]):
681686
List of pathnames of programs for the slurmctld daemon to execute
682687
before granting a new job allocation.

pyslurm/core/slurmctld/config.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,10 @@ cdef class Config:
457457
return cstr.to_list_with_count(self.ptr.epilog,
458458
self.ptr.epilog_cnt)
459459

460+
@property
461+
def epilog_timeout(self):
462+
return u16_parse(self.ptr.epilog_timeout)
463+
460464
@property
461465
def epilog_msg_time(self):
462466
return u32_parse(self.ptr.epilog_msg_time)
@@ -478,10 +482,6 @@ cdef class Config:
478482
def first_job_id(self):
479483
return u32_parse(self.ptr.first_job_id)
480484

481-
@property
482-
def get_environment_timeout(self):
483-
return u16_parse(self.ptr.get_env_timeout)
484-
485485
@property
486486
def gres_types(self):
487487
return cstr.to_list(self.ptr.gres_plugins)
@@ -847,8 +847,8 @@ cdef class Config:
847847
self.ptr.prolog_cnt)
848848

849849
@property
850-
def prolog_epilog_timeout(self):
851-
return u16_parse(self.ptr.prolog_epilog_timeout)
850+
def prolog_timeout(self):
851+
return u16_parse(self.ptr.prolog_timeout)
852852

853853
@property
854854
def prolog_slurmctld(self):

pyslurm/db/assoc.pyx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,6 @@ cdef class Association:
299299
def is_default(self):
300300
return u16_parse_bool(self.ptr.is_def)
301301

302-
@property
303-
def lft(self):
304-
return u32_parse(self.ptr.lft)
305-
306302
@property
307303
def max_jobs(self):
308304
return u32_parse(self.ptr.max_jobs, zero_is_noval=False)
@@ -367,10 +363,6 @@ cdef class Association:
367363
def priority(self, val):
368364
self.ptr.priority = u32(val)
369365

370-
@property
371-
def rgt(self):
372-
return u32_parse(self.ptr.rgt)
373-
374366
@property
375367
def shares(self):
376368
return u32_parse(self.ptr.shares_raw, zero_is_noval=False)

0 commit comments

Comments
 (0)