Skip to content
Snippets Groups Projects
README.md 2.32 KiB
Newer Older
  • Learn to ignore specific revisions
  • DERNAT Remy's avatar
    DERNAT Remy committed
    # slurm-partitions-stats
    
    
    This is a `sacct` python analysis program, made for complex partitions analysis.
    
    DERNAT Remy's avatar
    DERNAT Remy committed
    
    
    DERNAT Remy's avatar
    DERNAT Remy committed
    For instance, you can create `virtual_partitions` which can aggregate `sacct` data for many partitions pointing to the same physical nodes.
    
    DERNAT Remy's avatar
    DERNAT Remy committed
    
    
    Main purpose is to get the usage percentage of physical partitions, and the waiting times. You will also retrieve informations about cputime by partitions.
    
    > Please note that you can see 100%+ partition percentage; this is due to long time running jobs that can overlap between months.
    
    DERNAT Remy's avatar
    DERNAT Remy committed
    
    
    ## installation
    
    DERNAT Remy's avatar
    DERNAT Remy committed
    
    
    Clone this repository, create a virtualenv and install numpy.
    
    DERNAT Remy's avatar
    DERNAT Remy committed
    
    
    ```bash
    git clone https://forgemia.inra.fr/isdm-meso/slurm-partitions-stats.git
    python3 -m venv slurmstats_venv
    source slurmstats_venv/bin/activate
    cd slurm-partitions-stats
    python3 -m pip install numpy
    
    DERNAT Remy's avatar
    DERNAT Remy committed
    ```
    
    
    ## Configuration
    
    DERNAT Remy's avatar
    DERNAT Remy committed
    
    
    You need to configure the `config/clusterstats.conf.sample` according to your cluster configuration and rename it to `config/clusterstats.conf`.
    
    DERNAT Remy's avatar
    DERNAT Remy committed
    
    
    ## Usage
    
    
    First, you need data from your cluster with the `sacct` command.
    
    For example, you can do the following:
    
    ```bash
    #!/bin/bash
    mkdir csv
    for i in {2..4};
    do
        for j in {1..12};
        do
            cur_month=$(printf %02d $j)
            nb_days=$(cal ${j} 202${i}| awk 'NF {DAYS = $NF}; END {print DAYS}')
            /usr/bin/sacct --format CPUTimeRaw,ElapsedRaw,AllocCPUS,Partition,User,Submit,Start --state COMPLETED --parsable2 -S 202${i}-${cur_month}-01 -E 202${i}-${cur_month}-${nb_days} > csv/202${i}-${cur_month}.csv 2>&1
        done
    done
    /usr/bin/sacct --format CPUTimeRaw,ElapsedRaw,AllocCPUS,Partition,User,Submit,Start --state COMPLETED --parsable2 -S 2025-01-01 -E 2025-01-31 > csv/2025-01.csv 2>&1
    /usr/bin/sacct --format CPUTimeRaw,ElapsedRaw,AllocCPUS,Partition,User,Submit,Start --state COMPLETED --parsable2 -S 2025-02-01 -E 2025-02-28 > csv/2025-02.csv 2>&1
    /usr/bin/sacct --format CPUTimeRaw,ElapsedRaw,AllocCPUS,Partition,User,Submit,Start --state COMPLETED --parsable2 -S 2025-03-01 -E 2025-03-21 > csv/2025-03.csv 2>&1
    ```
    
    DERNAT Remy's avatar
    DERNAT Remy committed
    
    
    You will get statistics by month from 2022/01/01 to 2025/03/21 in a CSV directory.
    
    DERNAT Remy's avatar
    DERNAT Remy committed
    
    
    Then, copy your `csv` directory in the `slurm-partitions-stats` directory.
    
    DERNAT Remy's avatar
    DERNAT Remy committed
    
    
    After that, you just need to launch the analysis program :
    
    DERNAT Remy's avatar
    DERNAT Remy committed
    
    
    ```bash
    python compute_elapse_percentage.py
    ```
    
    DERNAT Remy's avatar
    DERNAT Remy committed
    
    
    
    You will get results in your terminal and in the `./results/csv/*` folders.