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.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Workers: a worker that waits for local ComfyUI work to make room says so in Settings → Workers
Adarsha8903e6fe441
diff --git a/docs/gpu-workers.md b/docs/gpu-workers.mdindex b662d18a..7117c39d 100644--- a/docs/gpu-workers.md+++ b/docs/gpu-workers.md@@ -245,7 +245,9 @@ local ComfyUI work counts as another program.When no studio job has come for a minute, the worker frees its own ComfyUI's memory (`/free`) and writes`siteWaiting: 0`, so your local work can go on. If no "yielded" comes within 3 minutes, the worker says so in its log-and in its beat (`waiting-for-yield:no-answer`). It goes on waiting, with the jobs kept in line.+and in its beat (`waiting-for-yield:no-answer`). It goes on waiting, with the jobs kept in line. While it waits,+Settings → Workers shows "Waiting for local ComfyUI work to make room", with the helper's estimate of the start when+there is one, never "Ready".**Limits that only the PC sets.** The studio can never change these:diff --git a/src/server/computer/pool.ts b/src/server/computer/pool.tsindex 686174b9..9fce48cb 100644--- a/src/server/computer/pool.ts+++ b/src/server/computer/pool.ts@@ -79,7 +79,7 @@ const factsOf = (w: WorkerRow) => json<ComputerFacts>(w.facts_json, {});const hoursOf = (w: WorkerRow): Hours | null => parseHours(json<unknown>(w.hours_json, null));const benchOf = (w: WorkerRow) => json<Record<string, { medianMs?: number; p90Ms?: number; loadMs?: number; peakVramBytes?: number }>>(w.bench_json, {});-export type WorkerState = "new" | "idle" | "busy" | "draining" | "paused" | "outside-hours" | "gpu-busy" | "comfy-down" | "offline";+export type WorkerState = "new" | "idle" | "busy" | "draining" | "paused" | "outside-hours" | "gpu-busy" | "comfy-down" | "waiting-for-yield" | "offline";/** The state in one word, and in words for the owner ("Paused here until 16:30", "Your GPU is busy (blender.exe)"). */export function workerState(w: WorkerRow, now = Date.now()): { state: WorkerState; words: string } {@@ -99,7 +99,14 @@ export function workerState(w: WorkerRow, now = Date.now()): { state: WorkerStatif (!h.inside) return { state: "outside-hours", words: h.nextChangeAt ? `Outside its hours (back at ${clock(h.nextChangeAt, tz)})` : "No hours set" };const busy = (db().prepare(`SELECT COUNT(*) AS n FROM relay_tasks WHERE worker_id = ? AND state IN ('sending','queued','running','collecting')`).get(w.id) as { n: number }).n > 0;if (w.drain) return busy ? { state: "draining", words: "Finishing its job, then pausing" } : { state: "paused", words: "Paused after its last job" };- return busy ? { state: "busy", words: "Running a job" } : { state: "idle", words: "Ready" };+ if (busy) return { state: "busy", words: "Running a job" };+ // Studio jobs first: local ComfyUI work on its machine holds the GPU, and the worker waits for it to make room. Not a+ // pause: its jobs keep their place. `local_until` is the estimate of the start, when there is one.+ if (why.startsWith("waiting-for-yield")) {+ if (why.endsWith(":no-answer")) return { state: "waiting-for-yield", words: "Waiting for local ComfyUI work to make room (no answer after 3 minutes)" };+ return { state: "waiting-for-yield", words: `Waiting for local ComfyUI work to make room${w.local_until ? ` (starts about ${clock(w.local_until, tz)})` : ""}` };+ }+ return { state: "idle", words: "Ready" };}/** May this worker take a new task now (4.3: paused in neither place, not draining, inside its hours, new enough, heard from)? */diff --git a/tests/workers-pool.test.ts b/tests/workers-pool.test.tsindex d7da019d..d0f24d7d 100644--- a/tests/workers-pool.test.ts+++ b/tests/workers-pool.test.ts@@ -369,6 +369,44 @@ describe("people's runs this worker may take now (the beat's claimableNow)", ()});});+describe("a worker waiting for local ComfyUI work to make room", () => {+ /** A beat that says the worker waits for its turn (not paused), with the helper's estimate of the start. */+ const waits = (w: W, why: string, until: number | null) =>+ pool.workerBeat(row(w), pool.cleanBeat({ device: `wkr-${w.id}`, protocol: 2, version: "1.0.0", local: { paused: false, why, until }, gpu: {}, inventoryHash: null, running: [], stopped: [] }), clock);++ it("says so in its state and the owner's list, never Ready, and its jobs keep their place", () => {+ const w = worker("waits");+ const id = task({ account: "acct-1" });+ const a = waits(w, "waiting-for-yield", clock + 4 * MIN);+ // Not a pause: it may still claim, and nothing goes back in line.+ expect(a.runner).toBe(true);+ expect(a.worker.pauseNow).toBe(false);+ expect(a.claimableNow).toBe(1);+ expect(pool.workerState(row(w), clock)).toMatchObject({ state: "waiting-for-yield", words: expect.stringMatching(/^Waiting for local ComfyUI work to make room \(starts about \d\d:\d\d\)$/) });+ expect(row(w).state).toBe("waiting-for-yield");+ const view = pool.listWorkers(clock).find((x) => x.id === w.id)!;+ expect(view.state).toBe("waiting-for-yield");+ expect(view.words).not.toBe("Ready");+ expect(state(id).state).toBe("waiting");+ // No estimate yet.+ waits(w, "waiting-for-yield", null);+ expect(pool.workerState(row(w), clock).words).toBe("Waiting for local ComfyUI work to make room");+ });++ it("with no answer after 3 minutes, says that, and a job it runs shows first", () => {+ const w = worker("no-answer");+ waits(w, "waiting-for-yield:no-answer", null);+ expect(pool.workerState(row(w), clock)).toEqual({ state: "waiting-for-yield", words: "Waiting for local ComfyUI work to make room (no answer after 3 minutes)" });+ task({ account: "acct-1" });+ expect(claim(w)).not.toBeNull();+ expect(pool.workerState(row(w), clock)).toEqual({ state: "busy", words: "Running a job" });+ // Its turn came: Ready again.+ waits(w, "", null);+ db().prepare("UPDATE relay_tasks SET state = 'done' WHERE worker_id = ?").run(w.id);+ expect(pool.workerState(row(w), clock)).toEqual({ state: "idle", words: "Ready" });+ });+});+describe("routes", () => {it("the beat's answer carries claimableNow", async () => {clock = Date.now();