Skip to content

galhar/slurm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Zsh plugin for SLURM

A zsh plugin for SLURM that provides convenient commands for running interactive SLURM jobs.

Features

  • sbsh - Run srun bash with configurable default arguments
  • sq - View queue for default partition (with formatted output)
  • sqme - View your own jobs in the queue (with formatted output)
  • Override any SLURM parameter on the fly
  • Customizable default SLURM parameters

Configuration

Set these environment variables in your .zshrc:

SLURM_DEFAULT_ACCOUNT=espresso
SLURM_DEFAULT_PARTITION=espresso
SLURM_DEFAULT_CPUS=4
SLURM_DEFAULT_GPUS=1
SLURM_DEFAULT_EXTRA_ARGS="--pty"

Defaults (if not set): espresso account/partition, 4 CPUs, 1 GPU, --pty extra args.

Usage

sbsh - Run interactive bash session

Default command:

sbsh
# Runs: srun -A espresso -p espresso -c 4 --gres=gpu:1 --pty bash

Examples:

# Override CPUs and GPUs
sbsh -c 16 -g 4

# Request specific GPU type
sbsh -g A100:2

# Override partition
sbsh -p public

# Pass any SLURM arguments (override defaults)
sbsh --time=01:00:00 --mem=32G
sbsh -A myaccount --partition=public

# Combine options
sbsh -c 16 -g A100:2 -p public --time=01:00:00 --mem=32G

Note: Any SLURM argument can be passed directly. User arguments override defaults (SLURM uses the last occurrence of conflicting flags).

sq - View queue

Default command:

sq
# Runs: squeue -p espresso --sort=+u -o "%.10i %.9P %.10j %.8u  %.10M %.6C %.14b %.10R" | sed 's/gres:gpu://g'

Examples:

# Specific partition
sq -p public
sq --partition=public

# With filters
sq -p public --states=RUNNING

sqme - View your jobs

Default command:

sqme
# Runs: squeue -u $USER --sort=+u -o "%.10i %.9P %.10j %.8u  %.10M %.6C %.14b %.10R" | sed 's/gres:gpu://g'

Examples:

# With filters
sqme --states=RUNNING
sqme --partition=public --states=PENDING

Installation

oh-my-zsh

cd ~/.oh-my-zsh/custom/plugins
git clone https://github.com/yourusername/slurm slurm

Add to .zshrc: plugins=(... slurm)

Zgen

Add to .zshrc: zgen load yourusername/slurm, then run zgen save

ZPM

Add to .zshrc: zpm load yourusername/slurm

Manual

git clone https://github.com/yourusername/slurm ~/.zsh/plugins/slurm

Add to .zshrc: source ~/.zsh/plugins/slurm/slurm.plugin.zsh

About

slurm zsh plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages