A CLI tool for Slurm cluster management with autocomplete functionality
Project description
Slurm CLI
A CLI tool for Slurm cluster management with autocomplete functionality.
Features
- Interactive command-line interface for Slurm cluster management via slurm commands wrapping
- Autocomplete support for commands and parameters
- Support for managing partitions, nodes, jobs, users, QoS, accounts, and reservations
- Rich console output with colored and formatted text
- Fast fuzzy matching for autocomplete suggestions
Installation
From PyPI
The easiest way to install slurm-cli is using pip:
pip install slurm-cli
From Source
To install from source:
# Clone the repository
git clone https://github.com/zhum/slurm-cli.git
cd slurm-cli
# Install dependencies using Poetry
poetry install
# Activate the virtual environment
poetry shell
Development Setup
For development, you'll also want to install the development dependencies:
poetry install --with dev
poetry run pre-commit install
Usage
Run the CLI tool:
slurm-cli
Or with Poetry:
poetry run slurm-cli
Autocomplete Setup
To enable bash autocompletion for this command:
- Install the completion script:
eval "$(_CLICK_COMPLETE=bash_source slurm-cli)"
-
Add the above line to your
~/.bashrcor~/.bash_profileto make it permanent. -
Restart your shell or run:
source ~/.bashrc
Alternatively, you can generate a completion script file:
_CLICK_COMPLETE=bash_source slurm-cli > \
~/.local/share/bash-completion/completions/slurm-cli
Development
Autocomplete
See AUTOCOMPLETE.md for implementation and development details.
Running Tests
poetry run pytest
# or with coverage
poetry run pytest --cov=slurm_cli
Code Formatting
poetry run black src tests
poetry run isort src tests
Type Checking
poetry run mypy src/
All Checks
make check
# or
poetry run tox
Building Documentation
make docs
# or
poetry run mkdocs build
# Serve locally
make docs-serve
# or
poetry run mkdocs serve
# Then open http://localhost:8000
Project Structure
slurm-cli/
├── src/
│ └── slurm_cli/ # Main package
│ ├── __init__.py
│ ├── cli.py # CLI entry point
│ └── utils/ # Utility functions
├── tests/ # Test files
├── docs/ # Documentation
├── pyproject.toml # Poetry configuration
├── Makefile # Development commands
├── tox.ini # Multi-environment testing
├── .pre-commit-config.yaml # Pre-commit hooks
└── README.md # This file
Requirements
- Python 3.9 or higher
- Slurm cluster environment
- Required Python packages (automatically installed):
- click>=8.1.0
- rich>=13.0.0
- fast-autocomplete[levenshtein]>=0.9.0
- rapidfuzz>=3.13.0
License
MIT License - see the LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run the test suite
- Submit a pull request
Changelog
See CHANGELOG.md for a list of changes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file slurm_cli-1.0.2.tar.gz.
File metadata
- Download URL: slurm_cli-1.0.2.tar.gz
- Upload date:
- Size: 107.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.12.3 Linux/6.17.0-23-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89c427edcccfdcf900029feed0f10f3f34a7ff984902597e52e53573e03944a3
|
|
| MD5 |
d64e14808204e5b2c22105cf68d56beb
|
|
| BLAKE2b-256 |
382950f177c0b1c02e1dd56703d36c5e956b5e2064601945ac9fd24bdec734b0
|
File details
Details for the file slurm_cli-1.0.2-py3-none-any.whl.
File metadata
- Download URL: slurm_cli-1.0.2-py3-none-any.whl
- Upload date:
- Size: 124.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.12.3 Linux/6.17.0-23-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a6e3a5b0bf7fe60d3c237ee15f7a1b5138f54d3975fdae36f561b66ce2bc337
|
|
| MD5 |
d17ad89addff1fd0ea6dcb7c574c7699
|
|
| BLAKE2b-256 |
d66a6306f14ffacd723f18cb274ae79a380fe5714418378ddad5d25b0b7f8966
|