|
| 1 | +# PySlurm |
| 2 | + |
| 3 | +[](https://github.com/PySlurm/pyslurm/actions/workflows/pyslurm.yml) |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +PySlurm is the Python client library for the [Slurm](https://slurm.schedmd.com) HPC Scheduler. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +* [Slurm](https://slurm.schedmd.com) |
| 12 | +* [Python](https://www.python.org) |
| 13 | +* [Cython](https://cython.org) |
| 14 | + |
| 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 20.11 |
| 20 | + |
| 21 | +## Installation |
| 22 | + |
| 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. |
| 25 | + |
| 26 | +### Slurm installed using system defaults (/usr) |
| 27 | + |
| 28 | +```shell |
| 29 | +python setup.py build |
| 30 | +python setup.py install |
| 31 | +``` |
| 32 | + |
| 33 | +### Custom installation location |
| 34 | + |
| 35 | +```shell |
| 36 | +python setup.py build --slurm=PATH_TO_SLURM_DIR |
| 37 | +python setup.py install |
| 38 | +``` |
| 39 | + |
| 40 | +### Custom Slurm library and include directories |
| 41 | + |
| 42 | +```shell |
| 43 | +python setup.py build --slurm-lib=PATH_TO_SLURM_LIB --slurm-inc=PATH_TO_SLURM_INC |
| 44 | +python setup.py install |
| 45 | +``` |
| 46 | + |
| 47 | +### Indicate Blue Gene type Q on build line |
| 48 | + |
| 49 | +```shell |
| 50 | +python setup.py build --bgq |
| 51 | +``` |
| 52 | + |
| 53 | +### Cleanup build artifacts |
| 54 | + |
| 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 : |
| 57 | + |
| 58 | +```shell |
| 59 | +python setup.py clean |
| 60 | +``` |
| 61 | + |
| 62 | +## Documentation |
| 63 | + |
| 64 | +The API documentation is hosted at <https://pyslurm.github.io>. |
| 65 | + |
| 66 | +To build the docs locally, use [Sphinx](http://www.sphinx-doc.org) to generate |
| 67 | +the documentation from the reStructuredText based docstrings found in the |
| 68 | +pyslurm module once it is built: |
| 69 | + |
| 70 | +```shell |
| 71 | +cd doc |
| 72 | +make clean |
| 73 | +make html |
| 74 | +``` |
| 75 | + |
| 76 | +## Testing |
| 77 | + |
| 78 | +PySlurm requires an installation of Slurm. |
| 79 | + |
| 80 | +### Using a Test Container |
| 81 | + |
| 82 | +To run tests locally without an existing Slurm cluster, `docker` and |
| 83 | +`docker-compose` is required. |
| 84 | + |
| 85 | +Clone the project: |
| 86 | + |
| 87 | +```shell |
| 88 | +git clone https://github.com/PySlurm/pyslurm.git |
| 89 | +cd pyslurm |
| 90 | +``` |
| 91 | + |
| 92 | +Start the Slurm container in the background: |
| 93 | + |
| 94 | +```shell |
| 95 | +docker-compose up -d |
| 96 | +``` |
| 97 | + |
| 98 | +The cluster takes a few seconds to start all the required Slurm services. Tail |
| 99 | +the logs: |
| 100 | + |
| 101 | +```shell |
| 102 | +docker-compose logs -f |
| 103 | +``` |
| 104 | + |
| 105 | +When the cluster is ready, you will see the following log message: |
| 106 | + |
| 107 | +```text |
| 108 | +Cluster is now available |
| 109 | +``` |
| 110 | + |
| 111 | +Press CTRL+C to stop tailing the logs. Slurm is now running in a container in |
| 112 | +detached mode. `docker-compose` also bind mounds the git directory inside the |
| 113 | +container at `/pyslurm` so that the container has access to the test cases. |
| 114 | + |
| 115 | +Install test dependencies: |
| 116 | + |
| 117 | +```shell |
| 118 | +pipenv sync --dev |
| 119 | +``` |
| 120 | + |
| 121 | +Execute the tests inside the container: |
| 122 | + |
| 123 | +```shell |
| 124 | +pipenv run pytest -sv scripts/run_tests_in_container.py |
| 125 | +``` |
| 126 | + |
| 127 | +When testing is complete, stop the running Slurm container: |
| 128 | + |
| 129 | +```shell |
| 130 | +docker-compose down |
| 131 | +``` |
| 132 | + |
| 133 | +### Testing on an Existing Slurm Cluster |
| 134 | + |
| 135 | +You may also choose to clone the project and run tests on a node where Slurm is |
| 136 | +already compiled and installed: |
| 137 | + |
| 138 | +```shell |
| 139 | +git clone https://github.com/PySlurm/pyslurm.git |
| 140 | +cd pyslurm |
| 141 | +python3.9 setup.py build |
| 142 | +python3.9 setup.py install |
| 143 | +./scripts/configure.sh |
| 144 | +pipenv sync --dev |
| 145 | +pipenv run pytest -sv |
| 146 | +``` |
| 147 | + |
| 148 | +## Contributors |
| 149 | + |
| 150 | +PySlurm is made by [contributors like |
| 151 | +you](https://github.com/PySlurm/pyslurm/graphs/contributors). |
| 152 | + |
| 153 | +## Help |
| 154 | + |
| 155 | +Ask questions on the [PySlurm Google |
| 156 | +Group](https://groups.google.com/forum/#!forum/pyslurm) |
0 commit comments