/** * The resources one worker process runs with. */ export interface WorkerResources { /** * `--max-old-space-size`, in bytes. */ heapBytes: number; /** * DuckDB's `memory_limit`, in bytes, or 0 for a worker that opens no DuckDB instance. */ duckdbBytes: number; /** * DuckDB's `threads`. * * The parquet conversion uses `CONVERSION_THREADS` regardless of this value. * A multi-threaded conversion produces different bytes across runs, * so each worker uses one thread for all other DuckDB work. */ duckdbThreads: number; } /** * The worker classes, one per task kind. * * An `adapter` worker reads one source's input. * The WOF adapters read the WOF record store and peaked at 1,862 MiB (`wof-admin`, 79,116,868 rows) * and 636 MiB (`wof-postalcode`, 5,240,681 rows) by kernel `maxRSS` over the lab's full clone set. * * An `align` worker aligns one byte range of a canonical file and opens no DuckDB instance. * Align workers peaked at 0.43 GiB on 2026-11-24 and 0.48 GiB in the 2026-10-20 profile, * so the class reserves a quarter of the adapter's memory and a host runs about * four align workers in the memory of one adapter worker. * * A `partition` worker reads one row range of a large input and holds no dedup table. * The `adapter` worker that merges the partitions holds it. * * A `finish` worker sorts one source's ids and writes its parquet files through DuckDB. */ export declare const WORKER_CLASSES: { readonly adapter: { readonly heapBytes: number; readonly duckdbBytes: number; readonly duckdbThreads: 1; }; readonly partition: { readonly heapBytes: number; readonly duckdbBytes: number; readonly duckdbThreads: 1; }; readonly align: { readonly heapBytes: number; readonly duckdbBytes: 0; readonly duckdbThreads: 1; }; readonly finish: { readonly heapBytes: number; readonly duckdbBytes: number; readonly duckdbThreads: 1; }; }; export type WorkerClass = keyof typeof WORKER_CLASSES; /** * Native memory a worker holds outside its heap and DuckDB: stream buffers, the module graph, `sort` pipes. */ export declare const WORKER_NATIVE_ALLOWANCE_BYTES: number; /** * Host memory the budget leaves out: 4 GiB for the operating system, the page cache floor * and the CI runners that share the lab host, plus 0.5 GiB for the coordinator. * The coordinator stores merged tallies and no rows. */ export declare const HOST_RESERVE_BYTES: number; /** * Bytes one worker of `workerClass` reserves while it runs. */ export declare function workerReservationBytes(workerClass: WorkerClass): number; /** * A parallel build's memory plan. */ export interface WorkerBudget { jobs: number; hostMemoryBytes: number; budgetBytes: number; } /** * The `--jobs` a build takes when none is given: the most workers the host's * budget holds, capped at the host's CPU count. * * Returns 1 for a serial build when fewer than two workers fit. */ export declare function defaultBuildJobs(opts?: { hostMemoryBytes?: number; }): number; /** * Check that `jobs` workers fit in the host budget: one of the largest class and `jobs - 1` align workers. * * @throws When they exceed the budget. * The error lists each class's reservation and the largest `--jobs` that fits. */ export declare function planWorkerBudget(opts: { jobs: number; hostMemoryBytes?: number; }): WorkerBudget; //# sourceMappingURL=budget.d.ts.map