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:
@@ -0,0 +1,32 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { isExtAuthorized } from "@/lib/render-pipeline/ext-auth";
|
||||
import { toErrorResponse } from "@/lib/render-pipeline/errors";
|
||||
import { retryExport } from "@/lib/render-pipeline/exports";
|
||||
|
||||
// ── POST /api/ext/exports/{exportId}/retry (E14) ─────────────────────────────
|
||||
//
|
||||
// Retry a *_FAILED export from the AE panel: new RenderJob attempt, back to QUEUED.
|
||||
|
||||
export async function POST(
|
||||
req: NextRequest,
|
||||
{ params }: { params: Promise<{ exportId: string }> }
|
||||
) {
|
||||
if (!isExtAuthorized(req)) {
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
const { exportId } = await params;
|
||||
let note: string | undefined;
|
||||
try {
|
||||
const body = await req.json();
|
||||
if (typeof body?.note === "string") note = body.note;
|
||||
} catch {
|
||||
// empty body is fine
|
||||
}
|
||||
try {
|
||||
const result = await retryExport(exportId, { type: "USER", note: note ?? "Retry from AE panel" });
|
||||
return NextResponse.json(result);
|
||||
} catch (err) {
|
||||
const { body, status } = toErrorResponse(err);
|
||||
return NextResponse.json(body, { status });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { isExtAuthorized } from "@/lib/render-pipeline/ext-auth";
|
||||
import { toErrorResponse } from "@/lib/render-pipeline/errors";
|
||||
import { getExportDetail } from "@/lib/render-pipeline/exports";
|
||||
|
||||
// ── GET /api/ext/exports/{exportId} (E3) ─────────────────────────────────────
|
||||
//
|
||||
// Export detail incl. render attempts and audit events (validations/QC join in
|
||||
// later phases).
|
||||
|
||||
export async function GET(
|
||||
req: NextRequest,
|
||||
{ params }: { params: Promise<{ exportId: string }> }
|
||||
) {
|
||||
if (!isExtAuthorized(req)) {
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
const { exportId } = await params;
|
||||
try {
|
||||
const result = await getExportDetail(exportId);
|
||||
return NextResponse.json(result);
|
||||
} catch (err) {
|
||||
const { body, status } = toErrorResponse(err);
|
||||
return NextResponse.json(body, { status });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { isExtAuthorized } from "@/lib/render-pipeline/ext-auth";
|
||||
import { toErrorResponse } from "@/lib/render-pipeline/errors";
|
||||
import { getLatestExport } from "@/lib/render-pipeline/exports";
|
||||
|
||||
// ── GET /api/ext/exports/latest?shotCode=&projectCode= (E2) ──────────────────
|
||||
//
|
||||
// Latest export + status for the AE panel status header. Returns
|
||||
// { "export": null } when the shot has never been exported.
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
if (!isExtAuthorized(req)) {
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
const { searchParams } = new URL(req.url);
|
||||
const shotCode = searchParams.get("shotCode")?.trim();
|
||||
const projectCode = searchParams.get("projectCode")?.trim();
|
||||
if (!shotCode) {
|
||||
return NextResponse.json({ error: "shotCode query param is required" }, { status: 400 });
|
||||
}
|
||||
try {
|
||||
const result = await getLatestExport(shotCode, projectCode);
|
||||
return NextResponse.json(result);
|
||||
} catch (err) {
|
||||
const { body, status } = toErrorResponse(err);
|
||||
return NextResponse.json(body, { status });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { isExtAuthorized } from "@/lib/render-pipeline/ext-auth";
|
||||
import { toErrorResponse } from "@/lib/render-pipeline/errors";
|
||||
import { createExport } from "@/lib/render-pipeline/exports";
|
||||
|
||||
// ── POST /api/ext/exports (E1 — Queue Export) ────────────────────────────────
|
||||
//
|
||||
// Body: { manifest: RenderManifest, submittedByEmail?, priority?, force? }
|
||||
// The server decides the new version number, updates Shot.shotVersion/exrOutput,
|
||||
// supersedes older non-terminal exports, and creates Export(QUEUED) + RenderJob.
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
if (!isExtAuthorized(req)) {
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
let body: {
|
||||
manifest?: unknown;
|
||||
submittedByEmail?: string;
|
||||
priority?: number;
|
||||
force?: boolean;
|
||||
vfxScope?: string | null;
|
||||
submissionNote?: string | null;
|
||||
};
|
||||
try {
|
||||
body = await req.json();
|
||||
} catch {
|
||||
return NextResponse.json({ error: "Invalid JSON" }, { status: 400 });
|
||||
}
|
||||
if (!body.manifest) {
|
||||
return NextResponse.json({ error: "manifest is required" }, { status: 400 });
|
||||
}
|
||||
try {
|
||||
const result = await createExport({
|
||||
manifest: body.manifest,
|
||||
submittedByEmail: body.submittedByEmail ?? null,
|
||||
priority: typeof body.priority === "number" ? body.priority : undefined,
|
||||
force: body.force === true,
|
||||
// undefined inherits the shot's previous export values
|
||||
vfxScope: body.vfxScope,
|
||||
submissionNote: body.submissionNote,
|
||||
});
|
||||
return NextResponse.json(result, { status: 201 });
|
||||
} catch (err) {
|
||||
const { body: errBody, status } = toErrorResponse(err);
|
||||
return NextResponse.json(errBody, { status });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user