Skip to main content

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:

  1. Install the completion script:
eval "$(_CLICK_COMPLETE=bash_source slurm-cli)"
  1. Add the above line to your ~/.bashrc or ~/.bash_profile to make it permanent.

  2. 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

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Run the test suite
  6. Submit a pull request

Changelog

See CHANGELOG.md for a list of changes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slurm_cli-1.0.0.tar.gz (108.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slurm_cli-1.0.0-py3-none-any.whl (125.1 kB view details)

Uploaded Python 3

File details

Details for the file slurm_cli-1.0.0.tar.gz.

File metadata

  • Download URL: slurm_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 108.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

Hashes for slurm_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 07f7b9348ffb81308d1a6349d9a9f7a49615396d7cdd4c53353eb77475e01f89
MD5 09bbcf1d7a656c3d5f073b1bed52face
BLAKE2b-256 cadb5134f7330147cca7a3ec9b1c43cbc59767d5b81d5a7497c44f05f9f116c2

See more details on using hashes here.

File details

Details for the file slurm_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: slurm_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 125.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

Hashes for slurm_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07223c1f69279adb5bfe55f788b0f4ffa999ff5d6b07dc0b3336f905e2c9eb98
MD5 8324495bfe5dd70106c450ac112d4673
BLAKE2b-256 8991ee3749a6ff85606435a4f039d0f902521d9685ab41514291caf6fadd87f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page