Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Workers: a meta-batch job's results are taken with every pass it ran

Adarshe2f74dff49c3
diff --git a/src/app/api/gpu/computer/tasks/[id]/report/route.ts b/src/app/api/gpu/computer/tasks/[id]/report/route.ts
index 657c2195..75c82d36 100644
--- a/src/app/api/gpu/computer/tasks/[id]/report/route.ts
+++ b/src/app/api/gpu/computer/tasks/[id]/report/route.ts
@@ -1,5 +1,5 @@
import { cleanNodeTimes } from "@/lib/node-times";
-import { GIVE_BACK, PREVIEW_LIMITS, previewOf, RELAY_LIMITS, TAB_FAILURES, type ReportEvent } from "@/lib/relay";
+import { GIVE_BACK, META_BATCH_HISTORY, PREVIEW_LIMITS, previewOf, RELAY_LIMITS, TAB_FAILURES, type ReportEvent } from "@/lib/relay";
import { gateAsProxy, readBodyWithin } from "@/server/direct-gate";
import { callerKey, principalOf, rateOf, relayAnswer } from "@/server/computer/http";
import { noteFinished } from "@/server/computer/bench";
@@ -51,7 +51,8 @@ function eventOf(b: Record<string, unknown>): ReportEvent | null {
return b.entry && typeof b.entry === "object" ? { event: e, entry: b.entry as never, ...(num(b.peakVramBytes) !== undefined && { peakVramBytes: num(b.peakVramBytes) }), ...exec, ...why, ...(nodes && { nodes }) } : null;
}
case "passes":
- return Array.isArray(b.entries) && b.entries.length <= 64 ? { event: e, running: b.running === true, entries: b.entries as never, ...(b.running !== true && { ...exec, ...why }) } : null;
+ // Every pass a meta-batch job ran, as many as a worker reads back (a long clip upscaled to 4K takes 100 or more).
+ return Array.isArray(b.entries) && b.entries.length <= META_BATCH_HISTORY ?{ event: e, running: b.running === true, entries: b.entries as never, ...(b.running !== true && { ...exec, ...why }) } : null;
case "give-back":
return typeof b.why === "string" && (GIVE_BACK as readonly string[]).includes(b.why) ? { event: e, why: b.why as never } : null;
case "failed":
diff --git a/tests/workers-pool.test.ts b/tests/workers-pool.test.ts
index dbb9d005..38da1589 100644
--- a/tests/workers-pool.test.ts
+++ b/tests/workers-pool.test.ts
@@ -26,6 +26,7 @@ const lanesModule = await import("@/lib/lanes");
const { lanesFor, needsOf, laneOf } = lanesModule;
const { loadIndex } = await import("@/server/gpu/index-file");
const { QUEUE_DEFAULTS, queueSettings, runCeilingMs, saveQueueSettings } = await import("@/server/queue-settings");
+const { META_BATCH_HISTORY } = await import("@/lib/relay");
const LANE_A = "aaaaaaaaaaaa";
const LANE_B = "bbbbbbbbbbbb";
@@ -920,6 +921,20 @@ describe("a worker's own reports: giving a job back, its execution time, the inp
return { t, say };
}
+ it("a meta-batch job's finished passes are taken however many there are, up to what a worker reads back", async () => {
+ clock = Date.now();
+ const pass = (i: number) => ({ prompt: [i, `p-${i}`], status: { completed: true, status_str: "success" }, outputs: {} });
+ const id = task();
+ const { t, say } = await routed(worker("many-passes"), id);
+ expect((await say({ event: "sent", promptId: t.promptId })).status).toBe(200);
+ // 120 passes: a 10 s clip upscaled from 1080p to 4K at 2 frames a pass.
+ expect((await say({ event: "passes", running: false, entries: Array.from({ length: 120 }, (_, i) => pass(i)) })).status).toBe(200);
+ const over = task();
+ const late = await routed(worker("too-many-passes"), over);
+ expect((await late.say({ event: "sent", promptId: late.t.promptId })).status).toBe(200);
+ expect((await late.say({ event: "passes", running: false, entries: Array.from({ length: META_BATCH_HISTORY + 1 }, (_, i) => pass(i)) })).status).toBe(400);
+ });
+
it("a job given back goes back in line with its place, counts as an attempt, and the third time fails in plain words", async () => {
clock = Date.now();
const id = task();