(3/7) Expire suspended slots past their expiry

What does this MR do?

  • ExpireSuspended(now, grace): expires suspended slots more than grace past their expiry, and returns every expired slot, earliest expiry first. Slots with a resume in flight are skipped.
  • Resume refuses an expired slot with ErrSlotExpired.
  • New expire task-operation metric.

The grace is passed by the caller, so GitLab Runner applies the same grace to every executor.

Why was this MR needed?

Part 3 of 7. Until part 5 lands, an expired slot stays allocated: Release leaves suspended slots alone, and nothing frees it yet.

What's the best way to test this MR?

go test -race ./.... TestExpireSuspended, TestExpireSuspendedSkipsInFlightResume, TestExpiresAtPersistedAcrossRestart.

What are the relevant issue numbers?

Part of the stack started in !117 (merged).

MR stack

Merge in order:

  1. (1/7) Give acquired slots an optional expiry (!117 - merged) • Ashvin Sharma
  2. (2/7) Let an instance mark a suspended slot exp... (!119 - merged) • Ashvin Sharma
  3. (3/7) Expire suspended slots past their expiry (!120 - merged) • Ashvin Sharma (this MR)
  4. (4/7) Expose connect info for an expired slot's... (!121 - merged) • Ashvin Sharma
  5. (5/7) Free expired slots once their workload is... (!122 - merged) • Ashvin Sharma
  6. (6/7) Remove stopped instances whose slots have... (!123 - merged) • Ashvin Sharma
  7. (7/7) Refuse to resume a suspended slot past it... (!118 - merged) • Ashvin Sharma
Edited by Ashvin Sharma

Merge request reports

Loading
Loading