import type { LicensePolicy } from "@mailwoman/license/policy"; import { type AlignRangePlan } from "#build/align/range"; import type { WorkerResources } from "#build/budget"; import { type SourceBuildSettings } from "#build/source-record"; import { BuildProfile } from "#build/types"; import { type FileDerivation } from "#parquet/record"; import type { AdapterOptions } from "#types"; import { type CountryHoldout } from "#utils/split"; /** * The align settings a task contains, with each license pattern as its source and flags. */ export interface AlignTaskSettings { corpusVersion: string; synthesize: boolean; profile: BuildProfile; licensePolicy: LicensePolicy; excludeLicenses: { source: string; flags: string; }[]; holdouts: Record; trainShares: Record; } interface TaskBase { /** * Unique within the build, e.g. `ban/align-1-of-3`. */ id: string; source: string; resources: WorkerResources; /** * The task's own temporary root. * DuckDB uses it for the spill directory too. */ temporaryRoot: string; } export interface AdapterTask extends TaskBase { kind: "adapter"; /** * The module exporting the adapter, repository-relative, as `adapterModules` found it. */ adapterModule: string; adapterOptions: Omit & { inputPath: string; }; corpusVersion: string; /** * The run's derivation digest. * * Its manifest records the digest. * See `adapterRunInputs` in `#build/adapters`. */ inputs: string; intermediateDir: string; /** * Set for one partition of a partitioned run: the rows to read and the files * to write them and their record to. */ partition?: { rowRange: { start: number; end: number; }; outputPath: string; recordPath: string; } | null; /** * Set for the task that merges a partitioned run: each partition's record, in input order. */ mergeRecords?: string[] | null; } export interface AlignTask extends TaskBase { kind: "align"; canonicalPath: string; plan: AlignRangePlan; sourceDir: string; settings: AlignTaskSettings; } export interface FinishTask extends TaskBase { kind: "finish"; sourceDir: string; outputDir: string; adapterManifestPath: string; plans: AlignRangePlan[]; settings: AlignTaskSettings; buildSettings: SourceBuildSettings; derivation: FileDerivation; /** * Continue from the per-source parquet manifest an earlier attempt left. */ resume: boolean; } export type WorkerTask = AdapterTask | AlignTask | FinishTask; /** * A message a worker sends its coordinator. */ export type WorkerMessage = { type: "started"; task: string; heapLimitBytes: number; pid: number; } | { type: "progress"; task: string; message: string; } | { type: "finished"; task: string; maxRSSBytes: number; }; /** * The per-source parquet manifest a `finish` task keeps, so an interrupted one resumes at its next part. */ export declare const SOURCE_PARQUET_MANIFEST_FILE = "PARQUET_MANIFEST.json"; export declare function compileTaskLicensePatterns(settings: AlignTaskSettings): RegExp[]; /** * The module a worker process runs: `worker.ts` from source, `worker.js` from the compiled tree. * * The coordinator imports this function at runtime, so this module and what it * reaches enter the build's code hash beside the coordinator. */ export declare function workerModulePath(): string; /** * Run one task in this process. */ export declare function runWorkerTask(task: WorkerTask, report?: (message: string) => void): Promise; export {}; //# sourceMappingURL=worker.d.ts.map