Skip to content
Draft
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
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ pyslurm is the Python client library for the [Slurm Workload Manager](https://sl
* [Python](https://www.python.org) - >= 3.6
* [Cython](https://cython.org) - >= 0.29.37

This Version is for Slurm 25.05.x
This Version is for Slurm 25.11.x

## Versioning

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

## Installation

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

```shell
export SLURM_INCLUDE_DIR=/opt/slurm/25.05/include
export SLURM_LIB_DIR=/opt/slurm/25.05/lib
export SLURM_INCLUDE_DIR=/opt/slurm/25.11/include
export SLURM_LIB_DIR=/opt/slurm/25.11/lib
```

Then you can proceed to install pyslurm, for example by cloning the Repository:
Expand Down
6 changes: 3 additions & 3 deletions pyslurm.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%define python3_pkgversion 3.11

Name: python-pyslurm
Version: 25.5.0
Version: 25.11.0
%define rel 1
Release: %{rel}%{?dist}
Summary: Python interface to Slurm
Expand All @@ -15,8 +15,8 @@ BuildRequires: python%{python3_pkgversion}-wheel
BuildRequires: python%{python3_pkgversion}-Cython
BuildRequires: python%{python3_pkgversion}-packaging
BuildRequires: python-rpm-macros
BuildRequires: slurm-devel >= 25.05.0
BuildRequires: slurm >= 25.05.0
BuildRequires: slurm-devel >= 25.11.0
BuildRequires: slurm >= 25.11.0
Requires: python%{python3_pkgversion}

%description
Expand Down
6 changes: 3 additions & 3 deletions pyslurm/core/job/job.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ cdef class Job:
>>> pyslurm.Job(9999).modify(changes)
"""
changes._create_job_submit_desc(is_update=True)
changes.ptr.job_id = self.id
changes.ptr.step_id.job_id = self.id
verify_rpc(slurm_update_job(changes.ptr))

def hold(self, mode=None):
Expand Down Expand Up @@ -654,9 +654,9 @@ cdef class Job:
slurm_msg_t_init(&resp)

memset(&msg, 0, sizeof(msg))
msg.job_id = self.id
msg.step_id.job_id = self.id
req.msg_type = slurm.REQUEST_BATCH_SCRIPT
req.data = &msg
req.data = &msg

rc = slurm_send_recv_controller_msg(&req, &resp, working_cluster_rec)
verify_rpc(rc)
Expand Down
2 changes: 2 additions & 0 deletions pyslurm/core/job/step.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ from .job cimport Job
from libc.string cimport memcpy, memset
from pyslurm cimport slurm
from pyslurm.slurm cimport (
slurm_step_id_t,
job_step_info_t,
slurm_get_job_steps,
job_step_info_response_msg_t,
Expand All @@ -49,6 +50,7 @@ from pyslurm.utils.ctime cimport time_t
from pyslurm.core.job.task_dist cimport TaskDistribution
from pyslurm.db.stats cimport JobStepStatistics
from pyslurm.core.job cimport stats
from pyslurm.utils.helpers cimport init_step_id


cdef class JobSteps(dict):
Expand Down
21 changes: 10 additions & 11 deletions pyslurm/core/job/step.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ cdef class JobSteps(dict):
cdef:
JobStep step
uint32_t cnt = 0
slurm_step_id_t step_id = init_step_id()
dict steps = {}

rc = slurm_get_job_steps(<time_t>0, job_id, slurm.NO_VAL, &self.info,
flags)
step_id.job_id = job_id
rc = slurm_get_job_steps(&step_id, &self.info, flags)
verify_rpc(rc)

# zero-out a dummy job_step_info_t
Expand Down Expand Up @@ -235,10 +236,11 @@ cdef class JobStep:
cdef:
job_step_info_response_msg_t *info = NULL
JobStep wrap = None
slurm_step_id_t _step_id = init_step_id()

job_id = job_id.id if isinstance(job_id, Job) else job_id
rc = slurm_get_job_steps(<time_t>0, job_id, dehumanize_step_id(step_id),
&info, slurm.SHOW_ALL)
_step_id.job_id = job_id.id if isinstance(job_id, Job) else job_id
_step_id.step_id = dehumanize_step_id(step_id)
rc = slurm_get_job_steps(&_step_id, &info, slurm.SHOW_ALL)
verify_rpc(rc)

if info and info.job_step_count == 1:
Expand Down Expand Up @@ -311,9 +313,8 @@ cdef class JobStep:

>>> pyslurm.JobStep(9999, 1).send_signal(9)
"""
step_id = self.ptr.step_id.step_id
sig = signal_to_num(signal)
verify_rpc(slurm_signal_job_step(self.job_id, step_id, sig))
verify_rpc(slurm_signal_job_step(&self.ptr.step_id, sig))

def cancel(self):
"""Cancel a Job step.
Expand All @@ -327,8 +328,7 @@ cdef class JobStep:
>>> import pyslurm
>>> pyslurm.JobStep(9999, 1).cancel()
"""
step_id = self.ptr.step_id.step_id
verify_rpc(slurm_kill_job_step(self.job_id, step_id, 9, 0))
verify_rpc(slurm_kill_job_step(&self.ptr.step_id, 9, 0))

def modify(self, JobStep changes):
"""Modify a job step.
Expand All @@ -353,8 +353,7 @@ cdef class JobStep:
"""
cdef JobStep js = <JobStep>changes
js._alloc_umsg()
js.umsg.step_id = self.ptr.step_id.step_id
js.umsg.job_id = self.ptr.step_id.job_id
js.umsg.step_id = self.ptr.step_id
verify_rpc(slurm_update_step(js.umsg))

def as_dict(self):
Expand Down
2 changes: 1 addition & 1 deletion pyslurm/core/job/submission.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ cdef class JobSubmitDescription:
self._create_job_submit_desc()
verify_rpc(slurm_submit_batch_job(self.ptr, &resp))

job_id = resp.job_id
job_id = resp.step_id.job_id
slurm_free_submit_response_response_msg(resp)

return job_id
Expand Down
24 changes: 12 additions & 12 deletions pyslurm/core/partition.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -748,20 +748,20 @@ def _split_oversubscribe_str(val):


def _select_type_int_to_list(stype):
# The rest of the CR_* stuff are just some extra parameters to the select
# The rest of the SELECT_* stuff are just some extra parameters to the select
# plugin
out = _select_type_int_to_cons_res(stype)

if stype & slurm.CR_ONE_TASK_PER_CORE:
if stype & slurm.SELECT_ONE_TASK_PER_CORE:
out.append("ONE_TASK_PER_CORE")

if stype & slurm.CR_PACK_NODES:
if stype & slurm.SELECT_PACK_NODES:
out.append("PACK_NODES")

if stype & slurm.CR_CORE_DEFAULT_DIST_BLOCK:
if stype & slurm.SELECT_CORE_DEFAULT_DIST_BLOCK:
out.append("CORE_DEFAULT_DIST_BLOCK")

if stype & slurm.CR_LLN:
if stype & slurm.SELECT_LLN:
out.append("LLN")

return out
Expand All @@ -772,19 +772,19 @@ def _select_type_int_to_cons_res(stype):
# The 3 main select types are mutually exclusive, and may be combined with
# CR_MEMORY
# CR_BOARD exists but doesn't show up in the documentation, so ignore it.
if stype & slurm.CR_CPU and stype & slurm.CR_MEMORY:
if stype & slurm.SELECT_CPU and stype & slurm.SELECT_MEMORY:
return "CPU_MEMORY"
elif stype & slurm.CR_CORE and stype & slurm.CR_MEMORY:
elif stype & slurm.SELECT_CORE and stype & slurm.SELECT_MEMORY:
return "CORE_MEMORY"
elif stype & slurm.CR_SOCKET and stype & slurm.CR_MEMORY:
elif stype & slurm.SELECT_SOCKET and stype & slurm.SELECT_MEMORY:
return "SOCKET_MEMORY"
elif stype & slurm.CR_CPU:
elif stype & slurm.SELECT_CPU:
return "CPU"
elif stype & slurm.CR_CORE:
elif stype & slurm.SELECT_CORE:
return "CORE"
elif stype & slurm.CR_SOCKET:
elif stype & slurm.SELECT_SOCKET:
return "SOCKET"
elif stype & slurm.CR_MEMORY:
elif stype & slurm.SELECT_MEMORY:
return "MEMORY"
else:
return []
Expand Down
4 changes: 4 additions & 0 deletions pyslurm/core/slurmctld/config.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@ cdef class Config:
Parameters for the MCS Plugin.

{slurm.conf#OPT_MCSParameters}
metrics_type (str):
Name of the Metrics plugin used.

{slurm.conf#OPT_MetricsType}
min_job_age (int):
Minimum age (in seconds) of a completed Job before its record is
cleared from slurmctlds memory.
Expand Down
12 changes: 6 additions & 6 deletions pyslurm/core/slurmctld/config.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,6 @@ cdef class Config:
def accounting_storage_type(self):
return cstr.to_unicode(self.ptr.accounting_storage_type)

@property
def accounting_storage_user(self):
return cstr.to_unicode(self.ptr.accounting_storage_user)

@property
def accounting_store_flags(self):
out = []
Expand Down Expand Up @@ -569,8 +565,8 @@ cdef class Config:
return cstr.to_unicode(self.ptr.job_comp_user)

@property
def job_container_type(self):
return cstr.to_unicode(self.ptr.job_container_plugin)
def namespace_plugin(self):
return cstr.to_unicode(self.ptr.namespace_plugin)

@property
def job_defaults(self):
Expand Down Expand Up @@ -686,6 +682,10 @@ cdef class Config:
def mcs_parameters(self):
return cstr.to_list(self.ptr.mcs_plugin_params)

@property
def metrics_type(self):
return cstr.to_unicode(self.ptr.metrics_type)

@property
def min_job_age(self):
return u32_parse(self.ptr.min_job_age)
Expand Down
Loading
Loading