18/34
Part 4 of 5 · Big jobs and preemptionLearn and do

Reserve the nodes, then backfill what ends in time

A 64-GPU job needs 8 nodes. Here are 4 of the 8 that drain soonest, and the reservation starts at 90 minutes:

NodeBusy untilOpen to backfill
190 minno time left
260 min60 to 90 min
375 min75 to 90 min
4free now0 to 90 min: a 45-minute trial fits, a 2-hour one doesn't

The fix is a reservation plus backfill:

  1. When the big job reaches the head of its queue, or waits past a threshold, pick the nodes that will drain soonest. A node drains when the last job on it ends, judged by the jobs' declared time limits.
  2. Reserve those nodes from that time.
  3. New work may still start on them, but only if it will finish before the reservation begins. That's backfill.
  4. Everything else schedules as usual.

Say all 8 of the soonest-draining nodes drain within 90 minutes, as these four do. Then the reservation starts 90 minutes from now. A sweep trial with a 45-minute limit can start on node 4 now and end before the reservation. A trial with a 2-hour limit can't, so it goes elsewhere or waits.

Slurm, a cluster job scheduler, states the rule in one line: "Backfill scheduling will start lower priority jobs if doing so does not delay the expected start time of any higher priority jobs." A job that can't start now gets its resources reserved for its expected run time.

In the editor, write reservation_start(node_jobs, k) and can_backfill(now, limit, start). node_jobs holds one list per node: the minutes from now when each of its jobs ends.