feat(pipeline): render queue, worker service and automated preview generation

One "Queue Export" click now renders the EXR sequence, then rebuilds the shot
headlessly with the studio slate/overlay template to produce the delivery MOV
and review MP4. Implements RenderPipeline2 phases 1-2 plus the preview stage.

Server:
- New models Export, RenderJob, ExportEvent, Machine, WorkerHeartbeat, plus
  Project.deliveryConfig and per-submission slate fields (Export.vfxScope,
  Export.submissionNote, inherited from the shot's previous export).
  Both migrations are purely additive; no existing column is touched.
- lib/render-pipeline: server-enforced state machine, transactional version
  increment with supersede, atomic FOR UPDATE SKIP LOCKED claim gated by
  machine availability windows, and a lease reaper run from instrumentation.ts.
- /api/ext/* endpoints for the panel and workers; session-auth mirrors under
  /api/render and /api/machines for the web UI.
- Pipeline pages: render queue, export detail, machine monitoring, plus an
  Exports tab on shot detail.

RenderWorker (.NET 8 Windows service, new):
- Registration, heartbeat as cancel channel, claim loop, aerender runner with
  progress parsing and stall watchdog, crash recovery and disk-spooled
  reporting that survives server downtime.
- Preview stage: headless AE assembles the preview comp into a throwaway AEP
  with both output modules queued, then a single aerender pass renders them.
  Preview jobs are not claimed while an interactive AE session is open, so an
  artist's project is never taken over.

AE panel: Queue Export with live status polling, urgent flag, retry, and the
VFX Scope / Submission Note fields. Every existing panel action is unchanged.

Preview chaining ships disabled behind SystemConfig preview.enabled.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
twotalesanimation
2026-08-02 14:34:34 +02:00
parent 0d0f3e1a33
commit ae58dc0366
71 changed files with 11767 additions and 1 deletions
+41
View File
@@ -0,0 +1,41 @@
import { NextRequest, NextResponse } from "next/server";
import { toErrorResponse, PipelineError } from "@/lib/render-pipeline/errors";
import { requirePipelineUser, requirePipelineAdmin } from "@/lib/render-pipeline/session-auth";
import { updateMachine, type MachineAvailability } from "@/lib/render-pipeline/machines";
// ── PATCH /api/machines/{machineId} ──────────────────────────────────────────
//
// Body (all optional):
// enabled: boolean — admin kill-switch (admin/producer/supervisor)
// availability: {...}|null — §7.10 schedule config (admin/producer/supervisor)
// renderNowHours: number|0 — "Render Now" override (any studio user);
// 0 or null clears it
export async function PATCH(
req: NextRequest,
{ params }: { params: Promise<{ machineId: string }> }
) {
try {
const { machineId } = await params;
let body: { enabled?: boolean; availability?: MachineAvailability | null; renderNowHours?: number | null };
try {
body = await req.json();
} catch {
throw new PipelineError(400, "Invalid JSON");
}
// Render Now is available to every studio user (§7.10); enable/disable and
// availability windows are admin-level controls.
if (body.enabled !== undefined || body.availability !== undefined) {
await requirePipelineAdmin();
} else {
await requirePipelineUser();
}
const result = await updateMachine(machineId, body);
return NextResponse.json(result);
} catch (err) {
const { body, status } = toErrorResponse(err);
return NextResponse.json(body, { status });
}
}
+20
View File
@@ -0,0 +1,20 @@
import { NextResponse } from "next/server";
import { toErrorResponse } from "@/lib/render-pipeline/errors";
import { requirePipelineUser } from "@/lib/render-pipeline/session-auth";
import { listMachines } from "@/lib/render-pipeline/machines";
// ── GET /api/machines (E21) ──────────────────────────────────────────────────
//
// Machine list for the Machine Monitoring page: derived ONLINE/OFFLINE status,
// latest heartbeat stats, current job.
export async function GET() {
try {
await requirePipelineUser();
const machines = await listMachines();
return NextResponse.json({ machines });
} catch (err) {
const { body, status } = toErrorResponse(err);
return NextResponse.json(body, { status });
}
}