fix(kvb-org-queue): only load the queue causes holds heavy jobs behind an exclusive one, so host load no longer starves them all
0ba6e15made every non-light job wait behind an exclusive entry that live load holds, 'from the queue or outside it'. Under a load outside the queue that never drops (test_queue_replay's ram45: 45 % RAM used, so a quality-high with its 41 % share never fits under 85 %), the exclusive entry never starts and nothing heavy behind it does either: 70 jobs starved and the mean wait rose from 181 s to 1170 s. loaded_exclusive() now skips an Outside reason: such an entry stays out with the queue empty, so holding others back cannot help it. Once that load drops, the jobs then running turn its reason into the queue's own, the hold applies, and the entry starts when they end, so the starving head of0ba6e15(r12) stays covered. test_queue r4: the two asserts on an Outside reason expect their pre-0ba6e15 verdicts again (the heavy job and the twin pass); r5, r12 and the queue-caused r4 asserts keep the hold. Tests on the staged bytes (operator-approved runs): test_queue_replay.py 7 passed, 19 subtests (ram45 included; it failed in the full suite on the prior HEAD); test_queue.py 129 passed, 283 subtests. Security: MEDUSA over the 7 files of the four fix bundles on master: 100, all covered, 0 open findings. 🎯 Fix: 95 % 💥 Break: 3 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 92 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
056bc35d69
commit
b5cfa6e2c1
2 files changed
+14
-10
No files matched your search
@@ -706,9 +706,9 @@ def evaluate(entries: list[dict], free_gb: float, floor: float, stage: str, memo
|
||||
hotfix head, and behind any head whose kind is exclusive or that live
|
||||
load holds while queue jobs run; light ones wait too while load the
|
||||
queue causes holds a hotfix head. Behind an exclusive entry that only
|
||||
live load holds, from the queue or outside it, head or not, no later
|
||||
entry but a light one starts (loaded_exclusive()): it would keep that
|
||||
entry out once the load drops. An entry never passes an active,
|
||||
load the queue causes holds, head or not, no later entry but a light
|
||||
one starts (loaded_exclusive()): it would keep that entry out once the
|
||||
load drops. An entry never passes an active,
|
||||
granted or waiting entry enqueued before it that shares one of its
|
||||
claims (claims(): worktree, compose stack, slot): those form its
|
||||
line, which runs by enqueue time alone (in_lines()), never by rank,
|
||||
@@ -870,11 +870,15 @@ def loaded_exclusive(able: list[dict], verdicts: dict[str, str | None], loaded:
|
||||
"""Returns:
|
||||
The id of the first entry of able (blocked, not unstartable()) whose
|
||||
kind is exclusive and that only live load holds back (its verdict is
|
||||
its loaded reason), whether the queue or something outside it causes
|
||||
the load; a job of a kind that is not light, started now, would keep
|
||||
it out once the load drops (alone_reason()). None when there is none.
|
||||
its loaded reason), the queue's own jobs causing that load; a job of
|
||||
a kind that is not light, started now, would keep it out once they
|
||||
end (alone_reason()). None when there is none. An Outside reason
|
||||
never counts: the entry stays out with the queue empty, so holding
|
||||
others back would only starve them while that load lasts, and once
|
||||
it drops, the jobs then running turn the reason into the queue's.
|
||||
"""
|
||||
return next((e["id"] for e in able if e["kind"] in exclusive and e["id"] in loaded and verdicts[e["id"]] == loaded[e["id"]]), None)
|
||||
return next((e["id"] for e in able if e["kind"] in exclusive and e["id"] in loaded and not isinstance(loaded[e["id"]], Outside)
|
||||
and verdicts[e["id"]] == loaded[e["id"]]), None)
|
||||
|
||||
|
||||
def drained(order: list[dict], verdicts: dict[str, str | None], drain: str | None, could: set[str],
|
||||
|
||||
+3
-3
@@ -724,7 +724,7 @@ class TestBackfill(Passes, unittest.TestCase):
|
||||
waiting = [e for e in waiting if verdicts[e["id"]] is not None]
|
||||
self.fail("a steady stream starved the head")
|
||||
|
||||
def test_r4_load_from_outside_the_queue_drains_for_no_head_and_holds_back_only_non_light_jobs_behind_an_exclusive_one(self):
|
||||
def test_r4_load_from_outside_the_queue_drains_for_no_head_and_holds_back_no_job_while_queue_load_holds_heavy_ones_behind_an_exclusive_one(self):
|
||||
rules = {"exclusive": {"quality-high", "test"}, "light": {"test-nostack"},
|
||||
"slot_limits": {"quality-high": 1, "test": 1, "test-nostack": 4, "iteration": 3}}
|
||||
head, light = job(1, kind="quality-high", enqueued=NOW - 3700), job(2, kind="test-nostack", task="work/b", workdir="/l")
|
||||
@@ -734,14 +734,14 @@ class TestBackfill(Passes, unittest.TestCase):
|
||||
self.assertEqual(self.run_pass([head, light, heavy], loaded={"j1": ram}, drain="j1", **rules)[:2],
|
||||
({"j1": ram, "j2": None, "j3": "waits behind exclusive j1"}, None))
|
||||
self.assertEqual(self.run_pass([running, head, light, heavy], loaded={"j1": outside}, drain="j1", **rules)[:2],
|
||||
({"j1": ram, "j2": None, "j3": "waits behind exclusive j1"}, None))
|
||||
({"j1": ram, "j2": None, "j3": None}, None))
|
||||
self.assertEqual(self.run_pass([running, head, light, heavy], loaded={"j1": ram}, drain="j1", **rules)[:2],
|
||||
({"j1": ram, "j2": None, "j3": "drained for j1"}, "j1"))
|
||||
self.assertEqual(self.run_pass([{**head, "kind": "iteration"}, light, heavy], loaded={"j1": ram}, drain="j1", **rules)[:2],
|
||||
({"j1": ram, "j2": None, "j3": None}, None))
|
||||
twin = job(4, kind="test", task="work/c", workdir="/w1")
|
||||
self.assertEqual((self.decide([head, twin], loaded={"j1": outside}, **rules), self.decide([head, twin], loaded={"j1": ram}, **rules)),
|
||||
({"j1": ram, "j4": "waits behind exclusive j1"}, {"j1": ram, "j4": "waits in line behind j1"}))
|
||||
({"j1": ram, "j4": None}, {"j1": ram, "j4": "waits in line behind j1"}))
|
||||
|
||||
def test_r12_a_test_job_never_backfills_past_an_exclusive_head_the_load_holds_while_no_job_runs(self):
|
||||
rules = {"exclusive": {"quality-high"}, "light": {"test-nostack"}, "slot_limits": {"quality-high": 1, "test": 1, "test-nostack": 4}}
|
||||
|
||||
Reference in new issue
Block a user