Loading
(2/7) Let an instance mark a suspended slot expired
What does this MR do?
Instance-level groundwork, no public API change:
Instance.ExpireSlot(slot, key, now, grace)marks a suspended slotExpiredoncenowis more thangracepast its expiry, and persists it. Slots without an expiry never expire.ResumeSlotrefuses an expired slot.Capacity()still counts an expired slot as suspended, and reports how many are expired in a newExpiredfield.
Why was this MR needed?
Part 2 of 7. The taskscaler-level ExpireSuspended in the next MR is built on this.
What's the best way to test this MR?
go test -race ./internal/.... TestExpireSlot, TestCapacityCountsExpiredAsSuspended, and the "slot expired" case in TestResumeSlotErrors.
What are the relevant issue numbers?
Part of the stack started in !117 (merged).
MR stack
Merge in order:
- (1/7) Give acquired slots an optional expiry (!117 - merged) • Ashvin Sharma
- (2/7) Let an instance mark a suspended slot exp... (!119 - merged) • Ashvin Sharma (this MR)
- (3/7) Expire suspended slots past their expiry (!120 - merged) • Ashvin Sharma
- (4/7) Expose connect info for an expired slot's... (!121 - merged) • Ashvin Sharma
- (5/7) Free expired slots once their workload is... (!122 - merged) • Ashvin Sharma
- (6/7) Remove stopped instances whose slots have... (!123 - merged) • Ashvin Sharma
- (7/7) Refuse to resume a suspended slot past it... (!118 - merged) • Ashvin Sharma
Edited by Ashvin Sharma