Skip to content

Commit 467667e

Browse files
authored
Build System and Versioning changes (#239)
* Rework the build system - Adds a pyproject.toml with build dependencies, so users can also easily do a "pip install" - Update MANIFEST.in file for sdist - add a test_requirements.txt for easy-install of any dependencies necessary for testing - Update README with build instructions Changes in setup.py: - remove Bluegene stuff, it wasn't used anywhere in the code at all - make some cosmetic changes - allow doing things like "sdist" and "clean" without depending on Cython - Depend atleast on Cython 0.29.30 as minimum version now. This way we can mostly make sure that users have recent Cython version to compile Version naming is changed: Make up the pyslurm version from the Slurm Major release (e.g. 22.5) and the current pyslurm patch-level for this major release, so we have for example: 22.5.0 We must make sure (document it) that users don't confuse this with Slurms patch version * Disable the auto_pickle feature which was causing that pyslurm wasn't able to be compiled on some kernels. auto pickling may also not be really needed in pyslurm, because by default classes with pointers/structs as attributes aren't generated with pickle support by cython anyway. For more info, check #236 Fixes #236 * Use libslurm.so instead of libslurmfull.so libslurm should be used for interfacing with the C-API, libslurmfull is more internal to the Slurm tools itself and cannot be guaranteed to be stable when used externally. No functions from libslurmfull were actually used in pyslurm.pyx so we can safely make the switch now. Also removes a few functions in slurm/extra.pxi, which are in libslurmfull but not used anywhere in the code Fixes #209 Co-authored-by: tazend <[email protected]>
1 parent c449a67 commit 467667e

File tree

9 files changed

+326
-389
lines changed

9 files changed

+326
-389
lines changed

MANIFEST.in

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
include pyslurm/alps_cray.h
2-
include pyslurm/bluegene.pxi
3-
include pyslurm/slurm_defines.pxi
4-
include pyslurm/slurm.pxd
5-
include pyslurm/xmalloc.h
61
include README.rst
72
include COPYING.txt
8-
include THANKS.rst
93
graft examples
104
graft tests
115
graft doc
6+
graft pyslurm/slurm
7+
graft pyslurm/pydefines
8+
include pyslurm/alps_cray.h

README.md

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,56 +8,51 @@ PySlurm is the Python client library for the [Slurm](https://slurm.schedmd.com)
88

99
## Prerequisites
1010

11-
* [Slurm](https://slurm.schedmd.com)
12-
* [Python](https://www.python.org)
13-
* [Cython](https://cython.org)
11+
* [Slurm](https://slurm.schedmd.com) - Slurm shared library and header files
12+
* [Python](https://www.python.org) - >= 3.6
13+
* [Cython](https://cython.org) - >= 0.29.30 but < 3.0
1414

15-
This PySlurm branch has been tested with:
16-
17-
* Cython (latest stable)
18-
* Python 3.6, 3.7, 3.8, and 3.9
19-
* Slurm 22.05
15+
This PySlurm branch is for the Slurm Major-Release 22.05
2016

2117
## Installation
2218

23-
You will need to instruct the setup.py script where either the Slurm install
24-
root directory or where the Slurm libraries and Slurm header files are.
19+
By default, it is searched inside `/usr/include` for the Header files and in
20+
`/usr/lib64` for Slurms shared-library (`libslurm.so`) during Installation.
21+
For Slurm installations in different locations, you will need to provide
22+
the corresponding paths to the necessary files.
2523

26-
### Slurm installed using system defaults (/usr)
24+
You can specify these Paths with environment variables, for example:
2725

2826
```shell
29-
python setup.py build
30-
python setup.py install
27+
export SLURM_INCLUDE_DIR=/opt/slurm/22.05/include
28+
export SLURM_LIB_DIR=/opt/slurm/22.05/lib
3129
```
3230

33-
### Custom installation location
31+
Then you can proceed to install PySlurm, for example:
3432

3533
```shell
36-
python setup.py build --slurm=PATH_TO_SLURM_DIR
37-
python setup.py install
34+
pip install pyslurm==22.05.0
3835
```
3936

40-
### Custom Slurm library and include directories
37+
Or by cloning the repository:
4138

4239
```shell
43-
python setup.py build --slurm-lib=PATH_TO_SLURM_LIB --slurm-inc=PATH_TO_SLURM_INC
40+
git clone https://github.com/PySlurm/pyslurm.git && cd pyslurm
4441
python setup.py install
45-
```
4642

47-
### Indicate Blue Gene type Q on build line
48-
49-
```shell
50-
python setup.py build --bgq
43+
# Or simply with pip
44+
pip install .
5145
```
5246

53-
### Cleanup build artifacts
47+
Also see `python setup.py --help`
5448

55-
The build will automatically call a cleanup procedure to remove temporary build
56-
files but this can be called directly if needed as well with :
49+
## Release Versioning
5750

58-
```shell
59-
python setup.py clean
60-
```
51+
PySlurm's versioning scheme follows the official Slurm versioning. The first
52+
two numbers (MAJOR.MINOR) always correspond to Slurms Major-Release, for example
53+
`22.05`. The last number (MICRO) is however not tied in any way to Slurms
54+
MICRO version. For example, any PySlurm 22.05.X version should work with any
55+
Slurm 22.05.X release.
6156

6257
## Documentation
6358

@@ -138,8 +133,7 @@ already compiled and installed:
138133
```shell
139134
git clone https://github.com/PySlurm/pyslurm.git
140135
cd pyslurm
141-
python3.9 setup.py build
142-
python3.9 setup.py install
136+
pip install .
143137
./scripts/configure.sh
144138
pipenv sync --dev
145139
pipenv run pytest -sv

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[build-system]
2+
# Minimum requirements
3+
requires = [
4+
"setuptools==59.2.0",
5+
"wheel==0.37.0",
6+
"Cython>=0.29.30,<3.0",
7+
]
8+

pyslurm/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "22.05.2.0"
1+
__version__ = "22.5.0"

pyslurm/pyslurm.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# cython: embedsignature=True
22
# cython: profile=False
33
# cython: language_level=3
4+
# cython: auto_pickle=False
45
import os
56
import re
67
import sys

pyslurm/slurm/extra.pxi

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ cdef inline void xfree_ptr(void *__p):
2626

2727
cdef extern char *slurm_xstrdup(const char *str)
2828

29-
3029
#
3130
# Slurm time functions
3231
#
3332

34-
3533
cdef extern void slurm_secs2time_str(time_t time, char *string, int size)
3634
cdef extern void slurm_mins2time_str(time_t time, char *string, int size)
3735
cdef extern int slurm_time_str2mins(const char *string)
@@ -43,7 +41,6 @@ cdef extern time_t slurm_parse_time(char *time_str, int past)
4341
# Slurm Job functions
4442
#
4543

46-
4744
cdef extern void slurm_free_job_desc_msg(job_desc_msg_t *msg)
4845
cdef extern void slurm_free_job_info(job_info_t *job)
4946
cdef extern void slurm_free_job_info_members(job_info_t *job)
@@ -55,16 +52,11 @@ cdef extern char *slurm_job_share_string(uint16_t shared)
5552

5653
#
5754
# Slurm environment functions
58-
#
5955

6056
cdef extern void slurm_env_array_merge(char ***dest_array, const char **src_array)
6157
cdef extern char **slurm_env_array_create()
6258
cdef extern int slurm_env_array_overwrite(char ***array_ptr, const char *name, const char *value)
6359
cdef extern void slurm_env_array_free(char **env_array)
64-
# cdef extern void slurm_env_array_merge_slurm(char ***dest_array, const char **src_array)
65-
66-
67-
cdef extern int slurm_select_fini()
6860

6961
#
7062
# Misc
@@ -78,9 +70,4 @@ cdef extern void slurm_free_stats_response_msg (stats_info_response_msg_t *msg)
7870
cdef extern int slurm_addto_char_list_with_case(List char_list, char *names, bool lower_case_noralization)
7971
cdef extern int slurm_addto_step_list(List step_list, char *names)
8072
cdef extern int slurmdb_report_set_start_end_time(time_t *start, time_t *end)
81-
cdef extern int debug_str2flags(char *debug_flags, uint64_t *flags_out)
82-
cdef extern char *debug_flags2str(uint64_t debug_flags)
83-
cdef extern void slurm_sprint_cpu_bind_type(char *str, cpu_bind_type_t cpu_bind_type)
8473
cdef extern uint16_t slurm_get_track_wckey()
85-
cdef extern char *select_type_param_string(uint16_t select_type_param)
86-

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ build_requires = python-devel >= 2.7
1616
slurm-devel >= 17.11.5
1717
python-nose
1818
requires = slurm-slurmd slurm-slurmdbd
19-
use-bzip2 = 1
19+
use_bzip2 = 1
2020

2121
[build_sphinx]
2222
builder = man

0 commit comments

Comments
 (0)