feb1c7b3e9
Completes RenderPipeline2 phases 3-5. Additive throughout: with validation.enabled=false the pipeline behaves exactly as before. Validation (§8) runs on the worker straight after a render, while it still holds the job and the files are local. Everything is read from the EXR header — one 64 KB read per sampled frame, no pixel decode — so the engine needs no oiiotool. The render job deliberately stays open through the stage, so a worker that dies there is reaped and retried instead of stranding the export in VALIDATING. Timecode is the primary check and is anchored on the plate, never the API: measured on the live show, Shot.timecodeStart is the editorial in-point and sits one handle-length (8f) ahead of the plate, so checking against it would pass the defective exports and fail the correct ones. Reference precedence is manifest timing plate -> plate found on disk -> API value, and the API rank is WARN-only. The panel now resolves plate provenance by walking the comp's own footage layers, so the worker never guesses which element carries the comp's timing. Verified against real studio renders via the new --validate mode: it catches both defect classes seen in shipped work — the +8 handle offset and frame-derived timecode (00:00:41:17 = frame 1001 at 24fps). QC (§10) is one service behind two front doors, API-key for the panel and session for the web. PASS means ready to upload and nothing else; FAIL sets the comp task to CHANGES. The panel gains a QC section that imports the real EXR sequence at full res rather than the H.264. Delivery (§11) rides the existing queue as a DELIVERY_BUILD job: hard links with a copy fallback, verification by re-hashing delivered bytes against the validation-time digest, manifest.json and the CSV report. fsutil hardlink list is unavailable over SMB, so link identity is never queried — reading the bytes back covers links and copies alike. Also fixes ApiClient.ProgressAsync throwing on transport failure, which would have aborted work in flight during a brief server outage; progress reporting is best-effort by contract. Removes the stale RenderWorker/ rule from the root .gitignore. The worker's source is tracked like the rest of the repo and its own .gitignore already covers bin/, obj/ and publish/; the rule silently excluded new files while the existing 20 stayed tracked. Not yet applied: migration 20260813000000 was hand-written because the dev database was unavailable — run prisma migrate deploy and verify before relying on it. None of this has run against a live server. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
107 lines
4.4 KiB
TypeScript
107 lines
4.4 KiB
TypeScript
import { db } from "@/lib/db";
|
|
|
|
/**
|
|
* Pipeline-wide settings live in the existing SystemConfig key/value table
|
|
* (RenderPipeline2 §14.1) so the fleet can be tuned without redeploys.
|
|
*/
|
|
export const PIPELINE_CONFIG_DEFAULTS = {
|
|
"render.pollSeconds": 10,
|
|
"render.heartbeatSeconds": 30,
|
|
"render.leaseSeconds": 300,
|
|
"render.maxAttempts": 3,
|
|
"render.stallTimeoutSeconds": 600,
|
|
"render.urgentPriorityThreshold": 20,
|
|
"render.outputRoot": "//SAN",
|
|
// Validation stage (§8). Disabling it restores the pre-Phase-3 flow
|
|
// (render → preview) without a redeploy, for a bad engine release.
|
|
"validation.enabled": "true",
|
|
"validation.sampleEvery": 25,
|
|
/** Per-check severity overrides, e.g. {"exr_type":"warn"} (§17.3). */
|
|
"validation.overrides": "{}",
|
|
/** Frames of head handle the plates carry; only used for the API timecode fallback (§8.1a). */
|
|
"validation.handleFrames": 8,
|
|
/**
|
|
* Studio-wide delivery defaults (§11.2). A project's own `deliveryConfig`
|
|
* column overrides these key by key; `{}` falls through to the built-ins in
|
|
* lib/render-pipeline/deliveries.ts.
|
|
*/
|
|
"delivery.defaultConfig": "{}",
|
|
"preview.maxWidth": 1920,
|
|
// Preview stage (§9): headless AE rebuild of the render with slate/burn-ins
|
|
"preview.enabled": "true",
|
|
"preview.templateAep": "X:/shared_projects_2026/UNGO_VFX/production/working_files/UNG_VFXOVERLAY_SLATE_TEMPLATE.aep",
|
|
"preview.templateComp": "UNG_EXPORT_TEMPLATE",
|
|
"preview.overlayComp": "UNG_VFX_OVERLAY",
|
|
"preview.lutComp": "_SHOW LUT",
|
|
"preview.movTemplate": "4444 Tri",
|
|
"preview.mp4Template": "REVIEW_PREVIEW",
|
|
// Essential Property names on the NETFLIX_SLATE layer for the per-submission
|
|
// fields. If a name is wrong the build logs the template's actual property
|
|
// names as a warning, so it is a config fix rather than a code change.
|
|
"preview.slateScopeProp": "Scope",
|
|
"preview.slateSubmissionProp": "Notes",
|
|
} as const;
|
|
|
|
export type PipelineConfigKey = keyof typeof PIPELINE_CONFIG_DEFAULTS;
|
|
|
|
export async function getConfigValue(key: PipelineConfigKey): Promise<string> {
|
|
const row = await db.systemConfig.findUnique({ where: { key } });
|
|
return row?.value ?? String(PIPELINE_CONFIG_DEFAULTS[key]);
|
|
}
|
|
|
|
export async function getConfigNumber(key: PipelineConfigKey): Promise<number> {
|
|
const raw = await getConfigValue(key);
|
|
const n = Number(raw);
|
|
return Number.isFinite(n) ? n : Number(PIPELINE_CONFIG_DEFAULTS[key]);
|
|
}
|
|
|
|
export async function getConfigBoolean(key: PipelineConfigKey): Promise<boolean> {
|
|
const raw = (await getConfigValue(key)).trim().toLowerCase();
|
|
return raw === "true" || raw === "1" || raw === "yes";
|
|
}
|
|
|
|
/** Preview-stage settings handed to the worker inside the PREVIEW_ONLY manifest. */
|
|
export async function getPreviewConfig() {
|
|
const [
|
|
enabled, templateAep, templateComp, overlayComp, lutComp, movTemplate, mp4Template,
|
|
slateScopeProp, slateSubmissionProp,
|
|
] = await Promise.all([
|
|
getConfigBoolean("preview.enabled"),
|
|
getConfigValue("preview.templateAep"),
|
|
getConfigValue("preview.templateComp"),
|
|
getConfigValue("preview.overlayComp"),
|
|
getConfigValue("preview.lutComp"),
|
|
getConfigValue("preview.movTemplate"),
|
|
getConfigValue("preview.mp4Template"),
|
|
getConfigValue("preview.slateScopeProp"),
|
|
getConfigValue("preview.slateSubmissionProp"),
|
|
]);
|
|
return {
|
|
enabled, templateAep, templateComp, overlayComp, lutComp, movTemplate, mp4Template,
|
|
slateScopeProp, slateSubmissionProp,
|
|
};
|
|
}
|
|
|
|
/** Worker-facing config bundle returned by E6 registration. */
|
|
export async function getWorkerConfig() {
|
|
const [
|
|
pollSeconds, heartbeatSeconds, leaseSeconds, maxAttempts, stallTimeoutSeconds,
|
|
validationEnabled, validationSampleEvery, validationHandleFrames,
|
|
] = await Promise.all([
|
|
getConfigNumber("render.pollSeconds"),
|
|
getConfigNumber("render.heartbeatSeconds"),
|
|
getConfigNumber("render.leaseSeconds"),
|
|
getConfigNumber("render.maxAttempts"),
|
|
getConfigNumber("render.stallTimeoutSeconds"),
|
|
getConfigBoolean("validation.enabled"),
|
|
getConfigNumber("validation.sampleEvery"),
|
|
getConfigNumber("validation.handleFrames"),
|
|
]);
|
|
return {
|
|
pollSeconds, heartbeatSeconds, leaseSeconds, maxAttempts, stallTimeoutSeconds,
|
|
// Whether the validation stage runs is the server's call, so switching it
|
|
// off is a config change here rather than a redeploy of every worker (§8).
|
|
validationEnabled, validationSampleEvery, validationHandleFrames,
|
|
};
|
|
}
|