Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
43e0220
WIP slurmctld config
tazend Jan 6, 2025
914953f
move cpu_freq_int_to_str to utils.helpers
tazend Jan 6, 2025
32b9012
cstr: add configurable delim to to_list
tazend Jan 7, 2025
27480d9
update partition unit tests
tazend Jan 7, 2025
20d3671
tests: integration tests for slurmctld
tazend Jan 7, 2025
863c287
partition: use _get_memory from slurmctld module
tazend Jan 7, 2025
18af658
partition: bump copyright
tazend Jan 7, 2025
8c5af16
slurmctld: start adding documentation
tazend Jan 7, 2025
af7f04b
add debug flags, fs dampening factor and logging level RPCs
tazend Jan 8, 2025
3467456
add more tests for slurmctld functions
tazend Jan 8, 2025
93a1d64
almost complete documentation for the config
tazend Jan 14, 2025
7724b57
slurmctld.Config: some name changes and further considerations
tazend Jan 14, 2025
8817146
refactor the slurmctld stuff into seperate modules
tazend Jan 17, 2025
bc8929b
partition: update from where we take _get_memory function
tazend Jan 17, 2025
339af33
slurmctld.config: update documentation to make it prettier
tazend Jan 17, 2025
4fd6443
mkdocs.yml: add pymdownx.magiclink
tazend Jan 17, 2025
d0e744b
docs: add griffe_exts.py script for prettier docs
tazend Jan 17, 2025
eca500a
slurmctld.config: update some params and docs
tazend Jan 17, 2025
130478c
slurmctld: seperate enums into different file
tazend Jan 18, 2025
a73708d
slurmctld: more docs
tazend Jan 18, 2025
c627af8
docs: ignore UNLIMITED constant in DynamicDocstrings extension
tazend Jan 18, 2025
ee49dcc
docs: add slurmctld reference API page
tazend Jan 18, 2025
e4b9114
docs: remove old config class documentation
tazend Jan 18, 2025
e26c640
slurmctld:plugin_dirs: use named kwargs
tazend Jan 18, 2025
adbdbbb
update common tests
tazend Jan 18, 2025
0f74c9f
fix code spelling errors
tazend Jan 18, 2025
207736a
fix docs
tazend Jan 18, 2025
0b29575
more doc stuff
tazend Jan 19, 2025
2738924
wip
tazend Jan 19, 2025
692bc85
remove the setup.py clean step from builddocs.sh
tazend Jan 19, 2025
82f1376
more doc fixes
tazend Jan 19, 2025
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
9 changes: 0 additions & 9 deletions docs/reference/config.md

This file was deleted.

8 changes: 8 additions & 0 deletions docs/reference/slurmctld.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: slurmctld
---

::: pyslurm.slurmctld
handler: python
options:
members: yes
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ plugins:
show_root_heading: true
show_symbol_type_toc: true
show_symbol_type_heading: true
extensions:
- scripts/griffe_exts.py:DynamicDocstrings

markdown_extensions:
- admonition
Expand All @@ -73,6 +75,7 @@ markdown_extensions:
- pymdownx.inlinehilite
- pymdownx.superfences
- pymdownx.details
- pymdownx.magiclink

extra:
version:
Expand Down
1 change: 1 addition & 0 deletions pyslurm/core/job/job.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ from pyslurm.utils.helpers import (
_getpwall_to_dict,
instance_to_dict,
_get_exit_code,
cpu_freq_int_to_str,
)


Expand Down
2 changes: 1 addition & 1 deletion pyslurm/core/job/step.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ from pyslurm.utils.helpers import (
uid_to_name,
humanize_step_id,
dehumanize_step_id,
cpu_freq_int_to_str,
)
from pyslurm.core.job.util import cpu_freq_int_to_str
from pyslurm.utils.ctime import (
secs_to_timestr,
mins_to_timestr,
Expand Down
31 changes: 0 additions & 31 deletions pyslurm/core/job/util.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -246,37 +246,6 @@ def cpu_freq_str_to_int(freq):
raise ValueError(f"Invalid cpu freq value: {freq}.")


def cpu_freq_int_to_str(freq):
"""Convert a numerical cpufreq value to its string representation."""
if freq == slurm.CPU_FREQ_LOW:
return "LOW"
elif freq == slurm.CPU_FREQ_MEDIUM:
return "MEDIUM"
elif freq == slurm.CPU_FREQ_HIGHM1:
return "HIGHM1"
elif freq == slurm.CPU_FREQ_HIGH:
return "HIGH"
elif freq == slurm.CPU_FREQ_CONSERVATIVE:
return "CONSERVATIVE"
elif freq == slurm.CPU_FREQ_PERFORMANCE:
return "PERFORMANCE"
elif freq == slurm.CPU_FREQ_POWERSAVE:
return "POWERSAVE"
elif freq == slurm.CPU_FREQ_USERSPACE:
return "USERSPACE"
elif freq == slurm.CPU_FREQ_ONDEMAND:
return "ONDEMAND"
elif freq == slurm.CPU_FREQ_SCHEDUTIL:
return "SCHEDUTIL"
elif freq & slurm.CPU_FREQ_RANGE_FLAG:
return None
elif freq == slurm.NO_VAL or freq == 0:
return None
else:
# This is in kHz
return freq


def dependency_str_to_dict(dep):
if not dep:
return None
Expand Down
21 changes: 2 additions & 19 deletions pyslurm/core/partition.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# partition.pyx - interface to work with partitions in slurm
#########################################################################
# Copyright (C) 2023 Toni Harzendorf <[email protected]>
# Copyright (C) 2023 PySlurm Developers
# Copyright (C) 2025 PySlurm Developers
#
# This file is part of PySlurm
#
Expand Down Expand Up @@ -31,6 +31,7 @@ from pyslurm.core.error import RPCError, verify_rpc
from pyslurm.utils.ctime import timestamp_to_date, _raw_time
from pyslurm.constants import UNLIMITED
from pyslurm.settings import LOCAL_CLUSTER
from pyslurm.core.slurmctld.config import _get_memory
from pyslurm import xcollections
from pyslurm.utils.helpers import (
uid_to_name,
Expand Down Expand Up @@ -832,21 +833,3 @@ cdef _concat_job_default_str(typ, val, char **job_defaults_str):
current.update({typ : _val})

cstr.from_dict(job_defaults_str, current)


def _get_memory(value, per_cpu):
if value != slurm.NO_VAL64:
if value & slurm.MEM_PER_CPU and per_cpu:
if value == slurm.MEM_PER_CPU:
return UNLIMITED
return u64_parse(value & (~slurm.MEM_PER_CPU))

# For these values, Slurm interprets 0 as being equal to
# INFINITE/UNLIMITED
elif value == 0 and not per_cpu:
return UNLIMITED

elif not value & slurm.MEM_PER_CPU and not per_cpu:
return u64_parse(value)

return None
62 changes: 0 additions & 62 deletions pyslurm/core/slurmctld.pyx

This file was deleted.

4 changes: 4 additions & 0 deletions pyslurm/core/slurmctld/__init__.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cython: c_string_type=unicode, c_string_encoding=default
# cython: language_level=3

from .config cimport Config
27 changes: 27 additions & 0 deletions pyslurm/core/slurmctld/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from .config import (
Config,
MPIConfig,
AccountingGatherConfig,
CgroupConfig,
)
from .enums import ShutdownMode
from .base import (
PingResponse,
ping,
ping_primary,
ping_backup,
ping_all,
shutdown,
reconfigure,
takeover,
add_debug_flags,
remove_debug_flags,
clear_debug_flags,
get_debug_flags,
set_log_level,
get_log_level,
enable_scheduler_logging,
is_scheduler_logging_enabled,
set_fair_share_dampening_factor,
get_fair_share_dampening_factor,
)
63 changes: 63 additions & 0 deletions pyslurm/core/slurmctld/base.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#########################################################################
# slurmctld/base.pxd - pyslurm slurmctld api functions
#########################################################################
# Copyright (C) 2025 Toni Harzendorf <[email protected]>
#
# This file is part of PySlurm
#
# PySlurm is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# PySlurm is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with PySlurm; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# cython: c_string_type=unicode, c_string_encoding=default
# cython: language_level=3

from pyslurm cimport slurm
from pyslurm.slurm cimport (
slurm_conf_t,
slurm_reconfigure,
slurm_shutdown,
slurm_ping,
slurm_takeover,
slurm_set_debugflags,
slurm_set_debug_level,
slurm_set_schedlog_level,
slurm_set_fs_dampeningfactor,
)
from libc.stdint cimport uint16_t, uint64_t
from pyslurm.utils.uint cimport u16_parse
from pyslurm.utils cimport cstr


cdef class PingResponse:
"""Slurm Controller Ping response information

Attributes:
is_primary (bool):
Whether this Slurm Controller is the primary Server.
is_responding (bool):
Whether this Slurm Controller actually responds to the ping.
index (int):
The index in the slurm.conf. For example, 0 means primary.
hostname (str):
Hostname of the Controller
latency (float):
The latency which the Controller responds with. This is in
milliseconds.
"""
cdef public:
is_primary
is_responding
index
hostname
latency
Loading
Loading