feat(hub): the hardware chart marks a blocked queue head and suspect-hung jobs
Each resources sample runs queue.py list --json once (the installed kvb-org-queue script, --queue in the unit, AGENTS_COUNCIL_ROOT set to the council) and keeps queue.head, {id, kind, waited_s, reason} of the first waiting row, and queue.hung, the ids of active rows whose reason says suspect hung; both are left out without one or while that run fails or prints no JSON list, and id, kind and reason are cut to 64 and 240 characters. Folded 15-minute and daily rows keep the last head and every hung id. The hardware chart draws a red band where the queue head waited blocked and a violet dashed band for suspect-hung jobs, each clickable for its job. MB becomes MEGABYTE.
The unit takes --queue /kvb-org-queue/scripts/queue.py; the install writes KVB_ORCHESTRATOR_SKILLS into the hub's .env (scripts/orchestrator.sh), which the offices unit already uses.
Applied cleanly onto motion (86a60c7); none of the 7 files changed on master since its base 2aea6d1.
Tests: test_hub_resources and test_resources_sample. Written, not run: the full suite runs once on master after all bundles (operator order).
Security: MEDUSA over the staged tree on master: 100, no findings over 5 files; kvb-orchestrator-resources.service (one added --queue argument) and style-resources.css (four style rules) are not covered and were read by hand.
🎯 Fix: 90 %
💥 Break: 5 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 86
🚦 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
86a60c7998
commit
9d313f227d
7 files changed
+370
-36
No files matched your search
@@ -1,10 +1,12 @@
|
||||
const RESOURCE = {left: 46, right: 10, wide: 50, top: 6, bottom: 6, axis: 18, poll: 5000, stale: 60, tones: 6, glyph: 6.5, shown: 100};
|
||||
const RESOURCE = {left: 46, right: 10, wide: 50, top: 6, bottom: 6, axis: 18, poll: 5000, stale: 60, tones: 6, glyph: 6.5, shown: 100, lane: 13};
|
||||
const RESOURCE_PANELS = [["hardware", "bi-cpu", "Hardware: disks, CPU, RAM, swap, GPU and VRAM"], ["tokens", "bi-coin", "Tokens per agent"], ["combined", "bi-layers", "Hardware, tokens and burnup"]];
|
||||
const RESOURCE_ZONES = {idle: "Idle: below 30 %", saturated: "Saturated: above 90 %"};
|
||||
const RESOURCE_MARKS = {
|
||||
wait: ["#bi-hourglass-split", (mark) => `${mark.peak} jobs waited while CPU and RAM stayed under 50 %`],
|
||||
asleep: ["#bi-moon", (mark) => `${mark.name} asleep`],
|
||||
unknown: ["#bi-question-circle", (mark) => `${mark.name} unknown: no reading`],
|
||||
wait: ["#bi-hourglass-split", (mark) => `Idle waiting: ${mark.peak} jobs waited while CPU and RAM stayed under 50 %`, 0],
|
||||
blocked: ["#bi-sign-stop", (mark) => revealed(`${mark.head} waited ${Math.round(mark.peak / 60)} min: ${mark.reason}`), 1],
|
||||
hung: ["#bi-pause-circle", (mark) => revealed(`suspect hung: ${mark.hung.join(", ")}`), 2],
|
||||
asleep: ["#bi-moon", (mark) => `${mark.name} asleep`, 0],
|
||||
unknown: ["#bi-question-circle", (mark) => `${mark.name} unknown: no reading`, 0],
|
||||
};
|
||||
const RESOURCE_BURN = {done: "Done", scope: "Scope"};
|
||||
const resourceView = {data: null, dom: null, busy: false, key: "", at: 0, timer: 0, series: {}};
|
||||
@@ -130,12 +132,38 @@
|
||||
if (right <= left) {
|
||||
continue;
|
||||
}
|
||||
const [href, words] = RESOURCE_MARKS[mark.kind];
|
||||
frame.svg.append(s("rect", {class: `res-mark ${mark.kind}`, "data-from": mark.from, "data-to": mark.to, "data-peak": mark.peak, x: fixed(left), width: fixed(Math.max(right - left, 2)), y: frame.top, height: fixed(frame.bottom - frame.top)}, s("title", {}, words(mark))));
|
||||
frame.svg.append(s("use", {class: `res-icon ${mark.kind}`, href, x: fixed(left + 2), y: frame.top + 2, width: 11, height: 11}));
|
||||
const [href, words, lane] = RESOURCE_MARKS[mark.kind];
|
||||
const press = (event) => {
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
event.preventDefault();
|
||||
resourceQueueSheet(mark);
|
||||
}
|
||||
};
|
||||
const open = mark.steps ? {role: "button", tabindex: 0, "aria-label": words(mark), on: {click: () => resourceQueueSheet(mark), keydown: press}} : {};
|
||||
frame.svg.append(s("rect", {class: `res-mark ${mark.kind}`, "data-from": mark.from, "data-to": mark.to, "data-peak": mark.peak, x: fixed(left), width: fixed(Math.max(right - left, 2)), y: frame.top, height: fixed(frame.bottom - frame.top), ...open}, s("title", {}, words(mark))));
|
||||
frame.svg.append(s("use", {class: `res-icon ${mark.kind}`, href, x: fixed(left + 2), y: frame.top + 2 + lane * RESOURCE.lane, width: 11, height: 11}));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mark - a blocked or hung mark: {kind, from, to, peak, steps, hung} and for blocked head.
|
||||
*/
|
||||
function resourceQueueSheet(mark) {
|
||||
const time = (t) => absolute.format(stampOf(t));
|
||||
const title = mark.kind === "blocked" ? `${mark.head} waited ${Math.round(mark.peak / 60)} min` : `Suspect hung: ${mark.hung.join(", ")}`;
|
||||
const steps = mark.steps.map((step) => h("li", {"data-head": step.id, "data-from": step.from, "data-to": step.to},
|
||||
h("div", {class: "row"}, h("code", {}, revealed(step.id)), h("span", {class: "muted"}, `${time(step.from)} to ${time(step.to)}`)),
|
||||
h("p", {class: "text"}, revealed(step.reason === "" ? "no reason given" : step.reason))));
|
||||
const hung = mark.hung.map((id) => h("li", {"data-hung": id}, h("code", {}, revealed(id))));
|
||||
openSheet(title, [
|
||||
h("p", {class: "muted"}, `${time(mark.from)} to ${time(mark.to)}`),
|
||||
h("h3", {}, "Queue head", counter(steps.length)),
|
||||
steps.length ? h("ul", {class: "mini"}, steps) : h("p", {class: "muted"}, "No job waited at the head of the queue."),
|
||||
h("h3", {}, "Suspect hung", counter(hung.length)),
|
||||
hung.length ? h("ul", {class: "mini"}, hung) : h("p", {class: "muted"}, "No active job was suspect hung."),
|
||||
], false);
|
||||
}
|
||||
|
||||
function resourceLines(frame, y, list) {
|
||||
for (const line of list) {
|
||||
for (const part of Resources.segments(line.points)) {
|
||||
@@ -311,6 +339,8 @@
|
||||
burn: view.combined ? burnSeries(span) : [],
|
||||
marks: [
|
||||
...Resources.waits(data.samples).map((mark) => ({...mark, kind: "wait"})),
|
||||
...Resources.blocked(data.samples).map((mark) => ({...mark, kind: "blocked"})),
|
||||
...Resources.hung(data.samples).map((mark) => ({...mark, kind: "hung"})),
|
||||
...["asleep", "unknown"].flatMap((kind) => Resources[kind](data.samples).flatMap((gpu) => gpu.spans.map((mark) => ({...mark, kind, name: gpu.name})))),
|
||||
],
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user