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.1.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.1-py3-none-any.whl (125.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: slurm_cli-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 e73fa575ce37a347ca17c8625e5e0099ef7a630c9dfafc535b29aa6e4ff3e45e
MD5 336bb91847e5ce1b417a4ef1a63cc0fb
BLAKE2b-256 18b3f9cf40859900c00c4eafb1352287898308a6b0d178c9f4483847ddb4a617

See more details on using hashes here.

File details

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

File metadata

  • Download URL: slurm_cli-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7f9d2a2553b8f8817e1b9521398fbebdfa20378cf7df0fa79442da6f285f2079
MD5 a4a64e228438fe2ce8167faa96550f1d
BLAKE2b-256 03886091ead57467bf77018a4a11ab6c6bde932e3e9f2710e1e3419d75db2620

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