Skip to content

Commit 130478c

Browse files
committed
slurmctld: seperate enums into different file
1 parent eca500a commit 130478c

File tree

3 files changed

+40
-8
lines changed

3 files changed

+40
-8
lines changed

pyslurm/core/slurmctld/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
AccountingGatherConfig,
55
CgroupConfig,
66
)
7+
from .enums import ShutdownMode
78
from .base import (
89
PingResponse,
9-
ShutdownMode,
1010
ping,
1111
ping_primary,
1212
ping_backup,

pyslurm/core/slurmctld/base.pyx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,7 @@ import time
3030
from enum import IntEnum
3131
from .config import Config
3232
from pyslurm.utils.uint import u16_parse
33-
34-
35-
class ShutdownMode(IntEnum):
36-
"""Mode of operation for shutdown action"""
37-
ALL = 0
38-
CORE_FILE = 1
39-
CONTROLLER_ONLY = 2
33+
from .enums import ShutdownMode
4034

4135

4236
cdef class PingResponse:

pyslurm/core/slurmctld/enums.pyx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#########################################################################
2+
# slurmctld/enums.pyx - pyslurm slurmctld enums
3+
#########################################################################
4+
# Copyright (C) 2025 Toni Harzendorf <[email protected]>
5+
#
6+
# This file is part of PySlurm
7+
#
8+
# PySlurm is free software; you can redistribute it and/or modify
9+
# it under the terms of the GNU General Public License as published by
10+
# the Free Software Foundation; either version 2 of the License, or
11+
# (at your option) any later version.
12+
13+
# PySlurm is distributed in the hope that it will be useful,
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
# GNU General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU General Public License along
19+
# with PySlurm; if not, write to the Free Software Foundation, Inc.,
20+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21+
#
22+
# cython: c_string_type=unicode, c_string_encoding=default
23+
# cython: language_level=3
24+
25+
from enum import IntEnum
26+
27+
class ShutdownMode(IntEnum):
28+
"""Mode of operation for shutdown action."""
29+
ALL = 0
30+
CORE_FILE = 1
31+
CONTROLLER_ONLY = 2
32+
33+
34+
# A bit hacky, but it works for now. Putting the docstring under the enum value
35+
# does not work unfortunately.
36+
ShutdownMode.ALL.__doc__ = "Shutdown all daemons (slurmctld and slurmd)"
37+
ShutdownMode.CORE_FILE.__doc__ = "Shutdown only slurmctld, and create a coredump"
38+
ShutdownMode.CONTROLLER_ONLY.__doc__ = "Shutdown only slurmctld, without a coredump"

0 commit comments

Comments
 (0)