Skip to content

hkust-hpc-team/slurm-helper-scripts

Repository files navigation

Slurm Usage Reporter

Overview

This script generates detailed resource utilization reports for HPC clusters using Slurm. Features include:

  • Hierarchical organization (Account → User → Partition)
  • Resource limit tracking (usage/capacity)
  • Automatic detection of active partitions
  • Terminal-adaptive formatting

Features

  • Multi-level reporting (Account > User > Partition)
  • Dynamic partition detection from cluster status
  • Usage cap tracking from Slurm associations
  • Automatic terminal width adjustment

Usage

squota [-h] [-u USERNAME] [-S START] [-E END] [-A ACCOUNT]

Key Options

  • -A,--account: Show specific account usage (admin only)
  • -S,--start: Start date (YYYY-MM-DD)
  • -E,--end: End date (YYYY-MM-DD)
  • -u,--username: Check specific user (admin only)

Sample Output

(base) bob@bcm2suheadnode-01:~/slurm-helper-scripts$ ./squota -u bob -S 2024-09-01
Warning: Report includes today's date. Some very recent jobs may not be included due to accounting delays.
For most accurate results, wait a few minutes and run the report again.
                            Usage report from 2024-09-01 to 2025-02-06                            
┌────────────┬───────────────────────┬───────────────────────────────────────────────────────────┐
│  Account   │ Account Total (Hours) │                          Details                          │
├────────────┼───────────────────────┼───────────────────────────────────────────────────────────┤
│ itscspod   │                 18.75 │ ┌──────────┬────────────────────┬───────────────────────┐ │
│            │                       │ │   User   │ User Total (Hours) │   Partition Details   │ │
│            │                       │ ├──────────┼────────────────────┼───────────────────────┤ │
│            │                       │ │ bob      │              18.75 │ ┌───────────┬───────┐ │ │
│            │                       │ │          │                    │ │ Partition │ Hours │ │ │
│            │                       │ │          │                    │ ├───────────┼───────┤ │ │
│            │                       │ │          │                    │ │ admin     │ 11.57 │ │ │
│            │                       │ │          │                    │ │ cpu       │  0.02 │ │ │
│            │                       │ │          │                    │ │ large     │  4.39 │ │ │
│            │                       │ │          │                    │ │ normal    │  2.76 │ │ │
│            │                       │ │          │                    │ └───────────┴───────┘ │ │
│            │                       │ └──────────┴────────────────────┴───────────────────────┘ │
│ myaccount  │                  0.22 │ ┌──────────┬────────────────────┬───────────────────────┐ │
│            │                       │ │   User   │ User Total (Hours) │   Partition Details   │ │
│            │                       │ ├──────────┼────────────────────┼───────────────────────┤ │
│            │                       │ │ bob      │               0.22 │ ┌───────────┬───────┐ │ │
│            │                       │ │          │                    │ │ Partition │ Hours │ │ │
│            │                       │ │          │                    │ ├───────────┼───────┤ │ │
│            │                       │ │          │                    │ │ normal    │  0.22 │ │ │
│            │                       │ │          │                    │ └───────────┴───────┘ │ │
│            │                       │ └──────────┴────────────────────┴───────────────────────┘ │
│ mscbdt2024 │                  0.15 │ ┌──────────┬────────────────────┬───────────────────────┐ │
│            │                       │ │   User   │ User Total (Hours) │   Partition Details   │ │
│            │                       │ ├──────────┼────────────────────┼───────────────────────┤ │
│            │                       │ │ bob      │               0.15 │ ┌───────────┬───────┐ │ │
│            │                       │ │          │                    │ │ Partition │ Hours │ │ │
│            │                       │ │          │                    │ ├───────────┼───────┤ │ │
│            │                       │ │          │                    │ │ normal    │  0.15 │ │ │
│            │                       │ │          │                    │ └───────────┴───────┘ │ │
│            │                       │ └──────────┴────────────────────┴───────────────────────┘ │
└────────────┴───────────────────────┴───────────────────────────────────────────────────────────┘
Note: "Hours" refers to GPU-hour for GPU partitions and CPU-core-hour for CPU partitions.

Installation

sudo ./install.sh

License

MIT Licensed - See LICENSE file