Files
vfxreview/lib/render-pipeline/preview-priority.test.ts
twotalesanimation c9b0f25bb2
Deploy / deploy (push) Successful in 6m11s
fix(pipeline): let a finished render's preview outrank pending renders
Urgent already propagated — a preview inherits its render's priority, so
an urgent export stays ahead all the way to QC. The complaint was the
other half: at equal priority previews always ran last.

The queue orders by priority then age, and a preview job is only created
when its render finishes, so it is always newer than the renders queued
beside it. Ten shots ran as ten renders and then ten previews, and
nothing was reviewable until the end of the batch.

render.previewPriorityBoost (default 1) subtracts from the render's
priority when the preview is created, so a shot finishes end to end
before the next render starts. The boost never promotes a job across the
urgent threshold: a normal preview must not inherit permission to run
outside the render window that its render never had. Set it to 0 for the
old behaviour.

Worth knowing separately: a worker will not claim preview jobs at all
while an artist has AE open on that machine, which during the day is the
larger reason previews appear to wait.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 12:11:49 +02:00

41 lines
1.6 KiB
TypeScript

import { describe, it, expect } from "vitest";
import { previewPriority } from "./preview";
/**
* A preview job is created when its render finishes, so it is always newer than
* the renders queued beside it. With the queue ordered by priority then age,
* equal priority means every pending render goes first — a batch of ten shots
* runs as ten renders and then ten previews, and nothing is reviewable until
* the end.
*/
describe("previewPriority", () => {
const URGENT = 20;
it("outranks other work of the same priority so a shot finishes end to end", () => {
expect(previewPriority(50, 1, URGENT)).toBe(49);
});
it("keeps an urgent export's preview urgent", () => {
// Urgent renders may claim outside the render window; their previews have
// to be able to follow, or the shot stalls one step from being reviewable.
expect(previewPriority(20, 1, URGENT)).toBe(19);
expect(previewPriority(19, 1, URGENT)).toBeLessThanOrEqual(URGENT);
});
it("never promotes a normal job across the urgent line", () => {
// 21 - 1 would be 20, quietly granting the preview permission to run
// outside the render window that its render never had.
expect(previewPriority(21, 1, URGENT)).toBe(21);
expect(previewPriority(25, 10, URGENT)).toBe(21);
});
it("a boost of zero restores the old phase behaviour", () => {
expect(previewPriority(50, 0, URGENT)).toBe(50);
});
it("ignores a negative boost and never goes below zero", () => {
expect(previewPriority(50, -5, URGENT)).toBe(50);
expect(previewPriority(0, 5, URGENT)).toBe(0);
});
});