diff --git a/ui/e2e/group-run.spec.ts b/ui/e2e/group-run.spec.ts
index 2c2f8d1a5f..33e0724436 100644
--- a/ui/e2e/group-run.spec.ts
+++ b/ui/e2e/group-run.spec.ts
@@ -1197,3 +1197,50 @@ test('a group run whose jobs all started on a newer version than its own counts
await note.click();
await expect(page.getByText('Not used: removes the group nightly')).toHaveCount(1);
});
+
+test('a group run names the jobs a failure held back, says on each row what held it, and its +N shows them all; idle ticks stay within budget', async ({ page }) => {
+ const { fake, run } = server(Array.from({ length: 20 }, (_, i) => `job_${String(i).padStart(2, '0')}`), 150);
+ const [failed, ...held] = run.members;
+ for (const k of Object.keys(failed.nodes)) failed.nodes[k] = 'success';
+ failed.nodes['model:job_00_10'] = 'failed';
+ failed.nodes['model:job_00_11'] = 'failed';
+ failed.failed = true;
+ for (const m of held) {
+ m.blockedBy = failed.jobKey;
+ for (const k of Object.keys(m.nodes)) m.nodes[k] = 'skipped';
+ }
+ await page.clock.install();
+ await fake.install(page);
+ await page.goto(`/runs/${run.id}`);
+
+ // The header names two of the 19 jobs held back and counts the rest; the failed job's row says nothing of being held.
+ const heldBack = page.getByTestId('held-back');
+ await expect(heldBack).toHaveText(/held back\s+job_01,\s*job_02\s*\+17/, { timeout: 30_000 });
+ const tree = page.getByTestId('run-tree');
+ const row = (job: string) => tree.getByRole('treeitem', { name: new RegExp(`^Open ${job}\\b`) }).first();
+ await expect(row('job_01')).toContainText('blocked by job_00 · job_00_10 failed (+1)');
+ await expect(row('job_00')).not.toContainText('blocked by');
+
+ // Clock ticks on an ended run with 19 blocked rows do no pass over its 3,000 nodes or its failures.
+ const settle = await countCalls(page, fake);
+ await page.clock.pauseAt(Date.now() + 1000);
+ await page.clock.runFor(4000);
+ await settle();
+ await page.clock.runFor(5000);
+ const idle = await settle();
+ expect(idle, `calls in 5 idle ticks: ${idle}`).toBeLessThan(5 * IDLE_CALLS_PER_TICK);
+
+ // +17 shows the blocked jobs in the tree: the failed job leaves it, the held ones stay.
+ await heldBack.getByRole('button', { name: '+17' }).click();
+ await page.clock.runFor(1000);
+ await expect(row('job_00')).toHaveCount(0);
+ await expect(row('job_01')).toBeVisible();
+ await page.screenshot({ path: test.info().outputPath('held-back-more.png') });
+
+ // A held job's panel goes from the failure upstream, through the job's own nodes it skipped, to what that left.
+ await row('job_01').getByRole('button', { name: 'job_01', exact: true }).click();
+ await page.clock.runFor(1000);
+ const chain = page.getByTestId('job-detail').getByTestId('job-error').getByRole('listitem');
+ await expect(chain).toHaveText([/^job_00\s*·\s*job_00_10 failed \(\+1\)\s*$/, /^job_01_0,\s*job_01_1\s*\+148\s*skipped$/, '150 nodes in this job skipped · 0 ran']);
+ await page.screenshot({ path: test.info().outputPath('held-back-panel.png') });
+});
diff --git a/ui/e2e/real/crash.spec.ts b/ui/e2e/real/crash.spec.ts
index 0201e275bd..a24da8fd58 100644
--- a/ui/e2e/real/crash.spec.ts
+++ b/ui/e2e/real/crash.spec.ts
@@ -54,11 +54,11 @@ test("a stopped worker's unreached nodes read as not run, and the jobs that read
const afterRow = page.locator(`.line.node[data-row="n:${crashRunId}:${[...crashNodes.values()].find((n) => n.node_key.endsWith('crash_after'))!.node_key}"]`);
await expect(afterRow.locator('.sb-mark')).toHaveAttribute('data-state', 'not_run');
- // The line under the title names the job that stopped and why, and that it held one job back, first.
+ // The line under the title names the job that stopped and why, and the job it held back, first.
const cause = page.getByTestId('root-cause').first();
await expect(cause).toContainText('crash_job');
await expect(cause).toContainText(/crash_wait failed: the worker (exited with code \d+|stopped) without reporting a result/);
- await expect(cause).toContainText('held back 1 job');
+ await expect(cause.getByTestId('held-back')).toHaveText(/held back\s+after_crash_job\s*$/);
await expect(page.getByTestId('run-summary')).toContainText('1 not run');
// A skipped node names the unreached node in the other job, and opens it.
diff --git a/ui/e2e/real/root-failures.spec.ts b/ui/e2e/real/root-failures.spec.ts
index e98606b702..bb3c6b770f 100644
--- a/ui/e2e/real/root-failures.spec.ts
+++ b/ui/e2e/real/root-failures.spec.ts
@@ -41,11 +41,34 @@ test("a sensor gets one run_failed for the group run, naming each root failure a
['feeds_job', 'return_feed', ['return_summary_job'], ['return_summary'], 1]
]);
- // The page's line under the title reads the same root failures: one job, its two failed nodes, two jobs held back.
+ // The page's line under the title reads the same root failures: one job, its two failed nodes, and the two jobs it
+ // held back by name.
await page.goto(`${server.uiUrl}/runs/${groupRunId}`);
const causes = page.getByTestId('root-cause');
await expect(causes).toHaveCount(1, { timeout: 30_000 });
await expect(causes).toContainText('feeds_job');
await expect(causes).toContainText('refund_feed failed (+1)');
- await expect(causes).toContainText('held back 2 jobs');
+ await expect(causes.getByTestId('held-back')).toHaveText(/held back\s+refund_summary_job,\s*return_summary_job/);
+
+ // Each held-back job's row says which job held it back and which of its nodes failed: each waits on its own feed.
+ const row = (job: string) => page.locator('[data-row]').filter({ has: page.getByRole('button', { name: job, exact: true }) });
+ await expect(row('refund_summary_job')).toContainText('blocked by feeds_job · refund_feed failed');
+ await expect(row('return_summary_job')).toContainText('blocked by feeds_job · return_feed failed');
+ await expect(row('feeds_job')).not.toContainText('blocked by');
+ await page.screenshot({ path: test.info().outputPath('blocked-rows.png') });
+
+ // A held job's panel: the failure that held it, the node of its own that skipped, and what that left of the job.
+ await row('refund_summary_job').getByRole('button', { name: 'refund_summary_job', exact: true }).click();
+ const chain = page.getByTestId('job-detail').getByTestId('job-error').getByRole('listitem');
+ await expect(chain).toHaveText([/^feeds_job\s*·\s*refund_feed failed\s*$/, /^refund_summary\s*skipped$/, '1 node in this job skipped · 0 ran']);
+ await page.screenshot({ path: test.info().outputPath('blocked-panel.png') });
+
+ // The tree as its own column, too narrow for the sentence, says "blocked" where "N failed" goes, and why on hover.
+ await page.evaluate(() => localStorage.setItem('sqlbuild.run.treeColumn', '1'));
+ await page.reload();
+ const column = page.getByTestId('tree-column');
+ const refund = column.locator('[data-row]').filter({ hasText: 'refund_summary_job' });
+ await expect(refund.getByText('blocked', { exact: true })).toHaveAttribute('title', 'blocked by feeds_job · refund_feed failed', { timeout: 30_000 });
+ await expect(column.locator('[data-row]').filter({ hasText: 'feeds_job' }).first().getByText('blocked', { exact: true })).toHaveCount(0);
+ await page.screenshot({ path: test.info().outputPath('blocked-rows-column.png') });
});
diff --git a/ui/e2e/support/fake-control.ts b/ui/e2e/support/fake-control.ts
index 0a60efdadb..4c07e932e2 100644
--- a/ui/e2e/support/fake-control.ts
+++ b/ui/e2e/support/fake-control.ts
@@ -62,6 +62,8 @@ export type FakeMemberRun = {
replaced?: boolean;
/** The job run has ended failed. */
failed?: boolean;
+ /** The job run has ended blocked, held back by this job's failed run; the server lists it under that job's root failures. */
+ blockedBy?: string;
/** Nodes it read that an earlier job built on an older version and that changed since, as the server sends them. */
staleReads?: { node_key: string; built_on_generation: number; changed_in_generation: number; built_by_run_id: string }[];
/** Rows a running node has written so far, as the server reports them, by node key. */
@@ -364,7 +366,8 @@ export class FakeControl {
.filter((m) => m.failed && !m.replaced)
.flatMap((m) => {
const failed = Object.keys(m.nodes).filter((key) => m.nodes[key] === 'failed').sort();
- return (failed.length ? failed : [null]).map((node_key) => ({ job_key: m.jobKey, node_key, blocked_jobs: [], blocked_nodes: [], blocked_node_count: 0 }));
+ const blocked_jobs = live.members.filter((b) => b.blockedBy === m.jobKey).map((b) => b.jobKey);
+ return (failed.length ? failed : [null]).map((node_key) => ({ job_key: m.jobKey, node_key, blocked_jobs, blocked_nodes: [], blocked_node_count: 0 }));
})
.sort((a, b) => a.job_key.localeCompare(b.job_key) || (a.node_key ?? '').localeCompare(b.node_key ?? ''));
// As the server: every node without `since` or from a version it never gave, else each run moved past `since`, whole.
@@ -449,8 +452,8 @@ export class FakeControl {
return {
run_id: run.id, location_id: LOCATIONS.shop, target: 'dev', snapshot_id: SNAPSHOT, snapshot_generation: (member && run.generation) || 1, git_revision: null, git_dirty: false, sqb_version: '0.0.0', image_id: null,
job_key: run.jobKey, kind: member ? 'job' : 'group', origin: 'manual', parent_run_id: member ? live.id : null, root_run_id: live.id, trigger_id: null, trigger_name: null, tick_id: null, rerun_of_run_id: (member && run.retry?.of) || null,
- requested_by: member && run.retry?.automatic ? 'system:retry' : 'principal:tester', requester_name: member && run.retry?.automatic ? null : 'tester', priority: 0, rewrite_history: false, status: member && run.replaced ? 'cancelled' : queued ? 'queued' : member && run.failed ? 'failed' : 'running', status_reason: null,
- queued_at: at, launched_at: queued ? null : at, started_at: queued ? null : at, ended_at: member && run.failed ? at : null, cancel_requested_at: member ? null : (live.cancelRequestedAt ?? null), node_counts_json: counts,
+ requested_by: member && run.retry?.automatic ? 'system:retry' : 'principal:tester', requester_name: member && run.retry?.automatic ? null : 'tester', priority: 0, rewrite_history: false, status: member && run.replaced ? 'cancelled' : queued ? 'queued' : member && run.failed ? 'failed' : member && run.blockedBy ? 'blocked' : 'running', status_reason: null,
+ queued_at: at, launched_at: queued ? null : at, started_at: queued ? null : at, ended_at: member && (run.failed || run.blockedBy) ? at : null, cancel_requested_at: member ? null : (live.cancelRequestedAt ?? null), node_counts_json: counts,
ignored_audit_failures: 0, last_event_storage_id: member ? run.cursor : 1, narrowing: null, member_attempt: (member && run.retry?.attempt) || null,
version_policy: member ? null : (live.versionPolicy ?? 'newest'), skipped_versions: member ? [] : (live.skippedVersions ?? []), stale_reads: (member && run.staleReads) || []
};
diff --git a/ui/src/routes/runs/[id]/job-drawer.svelte b/ui/src/routes/runs/[id]/job-drawer.svelte
index fed598e315..4bb1ae59fc 100644
--- a/ui/src/routes/runs/[id]/job-drawer.svelte
+++ b/ui/src/routes/runs/[id]/job-drawer.svelte
@@ -3,6 +3,7 @@
import type { RunNode } from '$lib/api';
import { formatAgo, formatDuration, formatStamp } from '$lib/format/time';
import { nodeLabel, outcomeCounts, shortRunId } from '$lib/operate/labels';
+ import { groupedCount } from '$lib/format/plural';
import { to } from '$lib/paths';
import { app } from '$lib/state/app.svelte';
import { createResource } from '$lib/state/resource.svelte';
@@ -12,6 +13,7 @@
import RunDrawer from './run-drawer.svelte';
import type { RunDetailState } from './state.svelte';
import { countsText, type TreeRow } from './utils/run-tree';
+ import { heldBy, rootFailed } from './utils/job-outcomes';
import { attemptFailure, failureLine } from '$lib/run/failure';
// A group run's job in the right-hand panel: how it went in this run (its nodes as a bar, what builds
@@ -114,8 +116,30 @@
{#if run?.statusReason && nodes.some((n) => n.status === 'not_run')}
{:else if topView === 'timeline' || !hasGraph}
diff --git a/ui/src/routes/runs/[id]/utils/job-outcomes.test.ts b/ui/src/routes/runs/[id]/utils/job-outcomes.test.ts
index 58ec4916ec..5225d2f0eb 100644
--- a/ui/src/routes/runs/[id]/utils/job-outcomes.test.ts
+++ b/ui/src/routes/runs/[id]/utils/job-outcomes.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import type { GroupRootFailure, Run, RunNode } from '$lib/api';
-import { causeLine, memberOutcomes, rootCauses } from './job-outcomes';
+import { blockedBy, causeLine, memberOutcomes, rootCauses } from './job-outcomes';
const member = (id: string, jobKey: string, status: Run['status'], endedAt: string | null = null, statusReason: string | null = null) =>
({ id, jobKey, status, endedAt, statusReason, memberAttempt: null, rerunOfRunId: null, parentRunId: 'g' }) as unknown as Run;
@@ -51,17 +51,18 @@ describe('member outcomes of a group run', () => {
});
describe('root causes of a group run', () => {
+ // crash_job skipped a node for load_job's failure too, but it failed on its own, so it is a cause, not held back.
it("lists the server's root failures by job, most held back first, with what failed and whether its run stopped short", () => {
const causes = rootCauses(members, failures, nodes);
- expect(causes.map((c) => [c.run.jobKey, c.failedNodes, c.heldBack, c.stopped])).toEqual([
- ['load_job', ['loader:raw'], 2, false],
- ['crash_job', [], 1, true],
- ['report_job', ['model:rep'], 0, false]
+ expect(causes.map((c) => [c.run.jobKey, c.failedNodes, c.held.map((h) => h.jobKey), c.stopped])).toEqual([
+ ['crash_job', [], ['publish_job'], true],
+ ['load_job', ['loader:raw'], ['stage_job'], false],
+ ['report_job', ['model:rep'], [], false]
]);
});
it('makes one cause of a job with two failed nodes, counting each job it held back once', () => {
const twice = rootCauses(members, [root('load_job', 'loader:a', ['stage_job']), root('load_job', 'loader:raw', ['stage_job', 'crash_job'])], nodes);
- expect(twice.map((c) => [c.run.jobKey, c.failedNodes, c.heldBack])).toEqual([['load_job', ['loader:a', 'loader:raw'], 2]]);
+ expect(twice.map((c) => [c.run.jobKey, c.failedNodes, c.held.map((h) => h.jobKey)])).toEqual([['load_job', ['loader:a', 'loader:raw'], ['stage_job']]]);
expect(causeLine(twice[0])).toBe('a failed (+1)');
});
});
@@ -74,8 +75,24 @@ describe('the line a root cause says', () => {
});
it('says what failed, why a run stopped short, and where an attempt stopped before any node', () => {
const said = rootCauses(members, failures, nodes).map(causeLine);
- expect(said).toEqual(['raw failed', 'worker stopped; physical exit or absence confirmed', 'rep failed']);
+ expect(said).toEqual(['worker stopped; physical exit or absence confirmed', 'raw failed', 'rep failed']);
const retry = { ...member('load2', 'load_job', 'failed', null, housekeeping), memberAttempt: 2, failure: { phase: 'worker_start', code: 'PythonNodeDiscoveryError', message: null } } as unknown as Run;
- expect(causeLine({ run: retry, failedNodes: [], heldBack: 0, stopped: true })).toBe("attempt 2 couldn't start: PythonNodeDiscoveryError");
+ expect(causeLine({ run: retry, failedNodes: [], held: [], stopped: true })).toBe("attempt 2 couldn't start: PythonNodeDiscoveryError");
+ });
+});
+
+describe('why a blocked job was held back', () => {
+ it('names the job and the node that failed upstream, from the root failures that list it', () => {
+ expect(blockedBy('stage_job', failures)).toBe('blocked by load_job · raw failed');
+ // A job held back by a job that failed before any node of its own: that job, with no node.
+ expect(blockedBy('publish_job', failures)).toBe('blocked by crash_job · failed');
+ });
+ it('counts a second failed node in the same job, and other jobs, rather than listing them', () => {
+ const two = [root('load_job', 'loader:a', ['stage_job']), root('load_job', 'loader:raw', ['stage_job']), root('crash_job', null, ['stage_job']), root('report_job', 'model:rep', ['stage_job'])];
+ expect(blockedBy('stage_job', two)).toBe('blocked by load_job · a failed (+1), and 2 more jobs');
+ });
+ it('says nothing for a job no root failure names, or a root failure that held back nothing', () => {
+ expect(blockedBy('ok_job', failures)).toBeNull();
+ expect(blockedBy('report_job', failures)).toBeNull();
});
});
diff --git a/ui/src/routes/runs/[id]/utils/job-outcomes.ts b/ui/src/routes/runs/[id]/utils/job-outcomes.ts
index 49344dfcf9..5844a798cd 100644
--- a/ui/src/routes/runs/[id]/utils/job-outcomes.ts
+++ b/ui/src/routes/runs/[id]/utils/job-outcomes.ts
@@ -27,8 +27,8 @@ export function memberOutcomes(members: readonly Run[]): Map {
return out;
}
-/** A job that failed on its own account, its failed nodes, and how many other jobs it held back. */
-export type RootCause = { run: Run; failedNodes: string[]; heldBack: number; stopped: boolean };
+/** A job that failed on its own account, its failed nodes, and the other jobs it held back (their latest attempts). */
+export type RootCause = { run: Run; failedNodes: string[]; held: Run[]; stopped: boolean };
/**
* A group run's root causes, from the root failures the server lists, one per job: its latest attempt, its failed
@@ -47,9 +47,12 @@ export function rootCauses(members: readonly Run[], failures: readonly GroupRoot
return [...byJob]
.flatMap(([job, { failedNodes, held }]) => {
const run = latest.get(job);
- return run ? [{ run, failedNodes, heldBack: held.size, stopped: stopped.has(run.id) }] : [];
+ // Held means blocked: the server also lists a job that failed or still runs and had a node skipped for this one,
+ // which is its own cause or not over yet. A held job with no run in the group (none read yet) can't be named.
+ const blocked = [...held].flatMap((k) => (latest.get(k)?.status === 'blocked' ? [latest.get(k)!] : []));
+ return run ? [{ run, failedNodes, held: blocked, stopped: stopped.has(run.id) }] : [];
})
- .sort((a, b) => b.heldBack - a.heldBack || (a.run.endedAt ?? '').localeCompare(b.run.endedAt ?? ''));
+ .sort((a, b) => b.held.length - a.held.length || (a.run.endedAt ?? '').localeCompare(b.run.endedAt ?? ''));
}
/**
@@ -66,3 +69,24 @@ export function causeLine(c: RootCause): string {
const failed = first ? `${nodeLabel(first)} failed${rest.length ? ` (+${rest.length})` : ''}` : c.stopped ? null : 'a check failed';
return [failed, why].filter(Boolean).join(': ') || 'failed';
}
+
+/** The root failure that held a blocked job back, the first the server names, with how many more nodes failed in its job and how many more jobs held this one back; null for a job no root failure names. */
+export function heldBy(jobKey: string, failures: readonly GroupRootFailure[]): { root: GroupRootFailure; moreNodes: number; moreJobs: number } | null {
+ const by = failures.filter((f) => f.blockedJobs.includes(jobKey));
+ if (!by.length) return null;
+ const [root] = by;
+ return { root, moreNodes: Math.max(0, by.filter((f) => f.jobKey === root.jobKey && f.nodeKey).length - 1), moreJobs: new Set(by.map((f) => f.jobKey)).size - 1 };
+}
+
+/** What failed at a root: its node, with a count of the others that failed in its job. */
+export const rootFailed = (h: { root: GroupRootFailure; moreNodes: number }) => (h.root.nodeKey ? `${nodeLabel(h.root.nodeKey)} failed${h.moreNodes ? ` (+${h.moreNodes})` : ''}` : 'failed');
+
+/**
+ * Why a blocked job didn't run, for its row: the job that held it back and what failed there, from the server's root
+ * failures; a second cause is a count. Null for a job no root failure names, which says only that it was blocked.
+ */
+export function blockedBy(jobKey: string, failures: readonly GroupRootFailure[]): string | null {
+ const h = heldBy(jobKey, failures);
+ if (!h) return null;
+ return `blocked by ${h.root.jobKey} · ${rootFailed(h)}${h.moreJobs ? `, and ${h.moreJobs} more ${h.moreJobs === 1 ? 'job' : 'jobs'}` : ''}`;
+}