Skip to content

Commit 9cd546e

Browse files
authored
fix: use latest_benchmarks for submissions to exclude overridden/failed runs (#147)
1 parent 3f8bfad commit 9cd546e

1 file changed

Lines changed: 19 additions & 23 deletions

File tree

packages/db/src/queries/submissions.ts

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export interface SubmissionVolumeRow {
1919
datapoints: number;
2020
}
2121

22-
/** Get unique config submissions with first/latest date and datapoint counts. */
22+
/** Get unique config submissions with first/latest date and datapoint counts.
23+
* Uses latest_benchmarks (deduplicated: newest per config+conc+isl+osl, no errors). */
2324
export async function getSubmissionSummary(sql: DbClient): Promise<SubmissionSummaryRow[]> {
2425
const rows = await sql`
2526
SELECT
@@ -36,39 +37,34 @@ export async function getSubmissionSummary(sql: DbClient): Promise<SubmissionSum
3637
c.prefill_ep,
3738
c.decode_tp,
3839
c.decode_ep,
39-
MIN(br.date)::text AS first_date,
40-
MAX(br.date)::text AS latest_date,
41-
COUNT(DISTINCT br.date)::int AS run_days,
40+
MIN(lb.date)::text AS first_date,
41+
MAX(lb.date)::text AS latest_date,
42+
COUNT(DISTINCT lb.date)::int AS run_days,
4243
COUNT(*)::int AS total_datapoints,
43-
COUNT(DISTINCT (br.isl, br.osl))::int AS distinct_sequences,
44-
COUNT(DISTINCT br.conc)::int AS distinct_concurrencies,
45-
MAX(br.conc)::int AS max_concurrency,
46-
(ARRAY_AGG(br.image ORDER BY br.date DESC) FILTER (WHERE br.image IS NOT NULL))[1] AS image
47-
FROM benchmark_results br
48-
JOIN configs c ON c.id = br.config_id
49-
JOIN latest_workflow_runs wr ON wr.id = br.workflow_run_id
50-
WHERE br.error IS NULL
51-
AND wr.conclusion IS NOT NULL
44+
COUNT(DISTINCT (lb.isl, lb.osl))::int AS distinct_sequences,
45+
COUNT(DISTINCT lb.conc)::int AS distinct_concurrencies,
46+
MAX(lb.conc)::int AS max_concurrency,
47+
(ARRAY_AGG(lb.image ORDER BY lb.date DESC) FILTER (WHERE lb.image IS NOT NULL))[1] AS image
48+
FROM latest_benchmarks lb
49+
JOIN configs c ON c.id = lb.config_id
5250
GROUP BY c.model, c.hardware, c.framework, c.precision, c.spec_method, c.disagg, c.is_multinode, c.num_prefill_gpu, c.num_decode_gpu, c.prefill_tp, c.prefill_ep, c.decode_tp, c.decode_ep
53-
ORDER BY MAX(br.date) DESC, COUNT(*) DESC
51+
ORDER BY MAX(lb.date) DESC, COUNT(*) DESC
5452
`;
5553
return rows as unknown as SubmissionSummaryRow[];
5654
}
5755

58-
/** Get daily datapoint counts by hardware for volume charts. */
56+
/** Get daily datapoint counts by hardware for volume charts.
57+
* Uses latest_benchmarks (deduplicated: newest per config+conc+isl+osl, no errors). */
5958
export async function getSubmissionVolume(sql: DbClient): Promise<SubmissionVolumeRow[]> {
6059
const rows = await sql`
6160
SELECT
62-
br.date::text,
61+
lb.date::text,
6362
c.hardware,
6463
COUNT(*)::int AS datapoints
65-
FROM benchmark_results br
66-
JOIN configs c ON c.id = br.config_id
67-
JOIN latest_workflow_runs wr ON wr.id = br.workflow_run_id
68-
WHERE br.error IS NULL
69-
AND wr.conclusion IS NOT NULL
70-
GROUP BY br.date, c.hardware
71-
ORDER BY br.date ASC
64+
FROM latest_benchmarks lb
65+
JOIN configs c ON c.id = lb.config_id
66+
GROUP BY lb.date, c.hardware
67+
ORDER BY lb.date ASC
7268
`;
7369
return rows as unknown as SubmissionVolumeRow[];
7470
}

0 commit comments

Comments
 (0)