Enhancing interactive and testing job support on RMACC Summit

For a long time now we at CURC have been trying to improve support for immediate-availability interactive and short-turnaround testing workflows in our batch computing environments. Historically we have roughly washed over both use cases with a single debug job type that gives a meaningful boost in job priority coupled with restrictions on use.

      Name   Priority     MaxWall     MaxTRESPU MaxJobsPU MaxSubmitPU
---------- ---------- ----------- ------------- --------- -----------
     debug        600    01:00:00       node=32         1           2

This has never been sufficient in practice, particularly for interactive jobs, which likely want to be able to run for more than 1h but aren't even guaranteed resources.

Our second attempt deprecated the debug QoS and replaced it with a set of interactive and testing QoS and partitions.

       Name     MaxWall MaxSubmitPU
----------- ----------- -----------
interactive    04:00:00           1
    testing    00:30:00           1
PartitionName=shas-interactive
   AllowQos=interactive
   QoS=shas-interactive

PartitionName=shas-testing
   AllowQos=testing
   QoS=shas-testing

            Name       GrpTRES     MaxTRESPU
---------------- ------------- -------------
shas-interactive        cpu=24         cpu=1
    shas-testing        cpu=48        cpu=24

The per-partition configuration QoS were used to limit how much resource could be consumed by each interactive or testing workflow. We then used a cron job to dynamically update the same values on the non-interactive and non-testing QoS, effectively reserving some resources from the general pool for use exclusively by interactive and testing jobs.

#!/bin/bash

function main
{
    for basename in "$@"
    do
        update_partition "${basename}"
    done
}

function update_partition
{
    local basename=$1
    local all_nodes=$(scontrol show partition "${basename}" --oneliner | grep -Eo ' Nodes=[^ ]+' | awk -F= '{print $2}')
    local available_nodes=$(scontrol show node "${all_nodes}" --oneliner | grep -Ev 'State=[^ ]*(DOWN|DRAIN)' | wc -l)
    local testing_nodes=$(sacctmgr show qos "${basename}-testing" --parsable --noheader | awk -F'|' '{print $9}' | awk -F= '{print $2}')
    local interactive_nodes=$(sacctmgr show qos "${basename}-interactive" --parsable --noheader | awk -F'|' '{print $9}' | awk -F= '{print $2}')
    local limit=$((available_nodes - testing_nodes - interactive_nodes))
    local limit_command="sacctmgr update qos "${basename}" set GrpTRES=node=${limit} --immediate --quiet"
    logger "${limit_command}"
    $limit_command >/dev/null
}

main "$@"

This did not work as intended because we failed to anticipate the reality of Slurm's node accounting in a shared-node environment. For example: if two users are each running a job on shas0101, each job is accounted for as using one "node." With 24 slots/node, the default shas partition can quickly reach its GrpTRES=node= value while leaving many slots and many nodes vacant. In certain workloads, moving to a GrpTRES=cpu= model resolves this issue; but since we were intentionally trying to ensure whole nodes would be reserved for use by testing jobs, this doesn't really solve our problem.

I used the term "reserved" there, and the obvious question becomes why we aren't using advance reservations for this use case. There are a few reasons why we didn't use them in the first place:

  1. We erroneously believed that a reservation would not dynamically select new nodes in the event of node failure.

  2. Advance reservations cannot truly be indefinite; nominally "INFINITE" reservations are actually 1 year long. This makes them seem unfit for a matter of permanent configuration.

  3. There is no first-class mechanism for controlling the behavior of individual users within a reservation: any authorized user can use all reserved resources, in contrast with the MaxTRESPU= values specified before.

But since our overlapping partition, GrpTRES=-based configuration didn't work as intended, our best option is advance reservations. #1 is addressed by having a better understanding of Slurm's capabilities. #2 is addressed by periodically (as infrequently as once/year) re-creating the reservation. And #3 is resolved by using a job submit script to ensure that only jobs with a permitted QoS may be submitted to the interactive and testing reservations.

Implementation

Our first step is to decommission the aforementioned cron jobs.

commit 338c94eebd24e6e062ae637cd83d8a7c8b14dd40
Author: Jonathon Anderson <jonathon.anderson@colorado.edu>
Date:   Sun May 19 19:51:43 2019 -0600

    Decommission update-dynamic-qos

    https://docs.google.com/document/d/12gS9IOpJQ9SdMlv9Du6ooS2N5WAjCZhNlPyriqjYSe0
[slurmdb1]# rm /etc/cron.d/update-dynamic-qos

# sacctmgr update --immediate qos shas set GrpTRES=cpu=-1

# sacctmgr update --immediate qos sgpu set GrpTRES=node=-1

# sacctmgr update --immediate qos sknl set GrpTRES=node=-1

These indirect node reservations are replaced with standard Slurm advance reservations.

scontrol create Reservation=shas-testing PartitionName=shas \
  NodeCnt=2 StartTime=now Duration=UNLIMITED Flags=REPLACE Users-=root

scontrol create Reservation=shas-interactive PartitionName=shas \
  NodeCnt=1 StartTime=now Duration=UNLIMITED Users-=root

scontrol create Reservation=sgpu-testing PartitionName=sgpu \
  NodeCnt=1 StartTime=now Duration=UNLIMITED Users-=root

scontrol create Reservation=sknl-testing PartitionName=sknl \
  NodeCnt=1 StartTime=now Duration=UNLIMITED Users-=root