Public: anyone can read this; the crew can change it.

A runner's checkout line names its parts: fetch, export and history apart #17380

opened this

Merged 30h 36m ago, live in production

runner-phases → main 0 commits

  • Merged. runner-phases was merged into main as d4f8e96.

Review

Sign in to review this change.
2 files changed +25 −4
src/runner/main.ts +11 −4
@@ -151,6 +151,12 @@ function fetchArgs(url: string, tip: MirrorTip, mode: "whole" | "shallow", shall
151151 return ["fetch", "--quiet", "--no-tags", ...how, url, tip.oid];
152152 }
153153
154 /** The checkout's line: the whole, then each part, in seconds. */
155 export function checkoutLine(commit: string, started: number, fetched: number, exported: number, done: number): string {
156 const s = (ms: number): string => (ms / 1000).toFixed(1);
157 return `runner: ${commit.slice(0, 7)} fetched and checked out in ${s(done - started)}s (fetch ${s(fetched - started)}s, export ${s(exported - fetched)}s, history ${s(done - exported)}s)`;
158 }
159
154160 /**
155161 * Fetch a job's tips into the runner's mirror, kept whole: a fetch without --depth brings only what
156162 * the mirror does not already hold, the pull's own commits once main's history is here, and none
@@ -401,17 +407,18 @@ export async function runRunner(options: RunnerOptions): Promise<RunnerEnd> {
401407 );
402408 const refused = await fetched;
403409 if (refused !== undefined) return await end({ abandon: refused });
410 const fetchedAt = Date.now();
404411 mkdirSync(jobDir, { recursive: true });
405412 const exported = await exportTree(mirror, job.commit, dir);
406413 if (!exported.ok) return await end({ abandon: exported.error });
414 const exportedAt = Date.now();
407415 if (job.base !== undefined) {
408416 const given = await giveHistory(mirror, dir, job.base, job.commit);
409417 if (!given.ok) return await end({ abandon: given.error });
410418 }
411 line(
412 "runner",
413 `runner: ${job.commit.slice(0, 7)} fetched and checked out in ${((Date.now() - started) / 1000).toFixed(1)}s`,
414 );
419 // Each part apart, so the slow one is named (fetch over the job's git door, the tree's export,
420 // the history the fast tier diffs against).
421 line("runner", checkoutLine(job.commit, started, fetchedAt, exportedAt, Date.now()));
415422 line("runner", await seedCheckout(forge, job, token, dir, stop.signal));
416423 const limits = resolveLimits("step", job.limits);
417424 const cell: CellSpec | undefined = cells.ok
test/runner-checkout-line.test.ts added +14
@@ -0,0 +1,14 @@
1 /**
2 * A runner's checkout line names each part (`runner/main.ts` checkoutLine): the fetch over the
3 * job's git door, the tree's export and the history, so a slow one is seen. On 2026-12-02 the whole
4 * took 19–62 s per check (median ~35 s) and nothing said which part.
5 */
6 import { expect, test } from "bun:test";
7 import { checkoutLine } from "../src/runner/main.ts";
8
9 test("the whole, then fetch, export and history, in seconds", () => {
10 const t0 = 1_000_000;
11 expect(checkoutLine("abcdef0123456789", t0, t0 + 21_400, t0 + 24_000, t0 + 26_500)).toBe(
12 "runner: abcdef0 fetched and checked out in 26.5s (fetch 21.4s, export 2.6s, history 2.5s)",
13 );
14 });

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs