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 claim picks the model variant a worker runs

Adarsh1340d1ad8cda
diff --git a/src/lib/relay.ts b/src/lib/relay.ts
index 6dc2b27f..f9623bec 100644
--- a/src/lib/relay.ts
+++ b/src/lib/relay.ts
@@ -202,6 +202,8 @@ export interface ClaimedTask {
notAfter?: number | null;
attempt?: number;
models?: { folder: string; name: string; size: number; sha256: string | null }[];
+ /** A worker's task that runs with a model variant's files (src/lib/gpu/model-variants.ts): its id. Absent: the workflow's own files. */
+ variant?: string;
/** A worker's task: its class in the line ("owner": the owner's own job), and its workflow. */
class?: "paid" | "free" | "owner";
workflowId?: string;
diff --git a/src/server/computer/pool.ts b/src/server/computer/pool.ts
index 3080a2a5..457b2a98 100644
--- a/src/server/computer/pool.ts
+++ b/src/server/computer/pool.ts
@@ -3,7 +3,9 @@ import { ENGINE_WORDS } from "@/lib/engine-error";
import crypto from "node:crypto";
import { FINISH_KINDS, type FinishTicket } from "@/lib/finish-ticket";
import { ceilingProblem, cleanCeiling, insideCeiling, lanesInside, type Ceiling } from "@/lib/job-ticket";
-import { allLanes, hasFiles, laneLabel, lanesFor, MEDIA_KINDS, needsOf, packKey, partLanes, unloadedNodes, type FileNeed, type Inventory, type NodePack, type Needs } from "@/lib/lanes";
+import { allLanes, hasFile, hasFiles, laneLabel, lanesFor, MEDIA_KINDS, minVramBytesFor, needsOf, packKey, partLanes, unloadedNodes, type FileNeed, type Inventory, type NodePack, type Needs } from "@/lib/lanes";
+import { fileChoices, hasVariants, pickFiles, swapGraphFiles, type FileChoice } from "@/lib/gpu/model-variants";
+import type { FileKey } from "@/lib/gpu/types";
import { POOL_WORDS, RELAY_TIMES, SENT_STATES, type BeatAnswer, type ClaimedTask, type ComputerFacts, type CpuSlot, type WorkerAnswer, type WorkerBeat, type WorkerHolding } from "@/lib/relay";
import { runtimeFileKeys } from "@/lib/runtime-files";
import { APPS, MODELS } from "@/lib/catalog";
@@ -47,6 +49,12 @@ export const TICKET_PROTOCOL = 3;
* the worker is updated.
*/
export const GRAPH_PROTOCOL = 4;
+/**
+ * The oldest worker program that runs a workflow with a model variant's files (src/lib/gpu/model-variants.ts): 5 composes
+ * a job ticket that names a variant with that variant's files, as its own catalog defines them. An older one gets the
+ * workflow's own files only.
+ */
+export const VARIANT_PROTOCOL = 5;
/** A worker behind the studio's version for less than this is updating; past it, the owner is shown "Update now". */
export const BEHIND_NOTICE_MS = 3 * 60_000;
/** The owner's "Update now" goes with each beat answer until the worker is on new code, or this long at most. */
@@ -867,16 +875,29 @@ function noteAsked(w: WorkerRow, answer: "found" | "nothing" | "blocked", words:
function claimed(t: TaskRow, w: WorkerRow, device: string, now: number): ClaimedTask {
const needs = json<Needs | null>(t.needs_json, null);
const bench = t.lane ? benchOf(w)[t.lane] : undefined;
- if (t.state === "waiting") logWorkerJob("claimed", t, w.id, now);
+ // A workflow with model variants: the files this worker runs it with, chosen when it takes the task from the line and
+ // kept on the task (extra_json.variant), so a worker that lost track of its task gets the same files again.
+ const { preempted, variant: lastVariant, ...extra } = json<Record<string, unknown>>(t.extra_json, {});
+ const index = loadIndex();
+ const variantOf = !t.finish_json && needs?.workflowId && hasVariants(index, needs.workflowId) ? needs.workflowId : null;
+ const choice = !variantOf
+ ? null
+ : t.state === "waiting"
+ ? workerFiles(w, variantOf)
+ : (fileChoices(index, variantOf).find((c) => c.variant === (typeof lastVariant === "string" ? lastVariant : null)) ?? null);
+ const variant = choice?.variant ?? undefined;
+ if (t.state === "waiting") logWorkerJob("claimed", t, w.id, now, {}, { ...(variant && { variant }) });
// A worker that lost track of its own task gets it again with its first claim's time, so the sending clock (SENDING_MS)
// is never wound back by asking again.
// A job ticket's task keeps the time of its claim before this one, and which claim that note is for (`claimFor`, this
// claim's time): a refusal of the ticket on this same claim, before anything ran (another catalog, more than the PC
// allows), puts it back as it was, so a task no worker ever ran keeps its wait limit.
// A run given back for people (workerBeat) is no longer paused once a worker takes it again.
- const { preempted, ...extra } = json<Record<string, unknown>>(t.extra_json, {});
const ticketNote = !!t.ticket_json && t.state === "waiting";
- const before = ticketNote || preempted !== undefined ? { extra_json: JSON.stringify({ ...extra, ...(ticketNote && { claimedBefore: t.claimed_at ?? null, claimFor: now }) }) } : {};
+ const before =
+ ticketNote || preempted !== undefined || variant !== lastVariant
+ ? { extra_json: JSON.stringify({ ...extra, ...(ticketNote && { claimedBefore: t.claimed_at ?? null, claimFor: now }), ...(variant && { variant }) }) }
+ : {};
const c = takeTask(t, device, now, { worker_id: w.id, ...before, ...(t.state !== "waiting" && t.device === device && t.claimed_at && { claimed_at: t.claimed_at }) });
// A GPU job taken by a worker with another model loaded (or none) loads its model first: it is "getting ready" until
// its first step reports. A light CPU job and a finishing job load none.
@@ -887,18 +908,45 @@ function claimed(t: TaskRow, w: WorkerRow, device: string, now: number): Claimed
// finishing job has its lane's run ceiling (queue-settings.ts, the owner's to set).
const limit = t.finish_json || runLimitedOf(t) ? runCeilingMs(t.lane) : runLimitMs(bench?.p90Ms, t.lane, bench?.loadMs);
const stall = Math.min(stallLimitMs(t.lane), limit);
+ // A variant's files: the owner's graph gets them in its model slots here; a job ticket names the variant and its files,
+ // and the worker composes the graph with them, as its own catalog defines the variant (src/lib/ticket-compose.ts).
+ const swap = choice?.variant ? choice.swap : null;
+ const fileOf = (k: FileKey): FileNeed[] => {
+ const f = index.files[k];
+ return f ? [{ folder: f.folder, name: f.file, size: f.sizeBytes, sha256: f.sha256 ?? null }] : [];
+ };
return {
...c,
+ ...(swap && c.graph && { graph: swapGraphFiles(c.graph, swap, index) }),
// A job ticket carries its run and stall limits too.
- ...(c.ticket && { ticket: { ...c.ticket, runLimitMs: limit, stallMs: stall } }),
+ ...(c.ticket && { ticket: { ...c.ticket, runLimitMs: limit, stallMs: stall, ...(swap && variant && { variant: { id: variant, files: swap } }) } }),
lane: t.lane ?? undefined,
estMs: estOn(t, w),
runLimitMs: limit,
stallMs: stall,
notAfter: t.not_after,
attempt: t.requeues + 1,
- models: needs?.files ?? [],
+ models: choice ? choice.files.flatMap(fileOf) : (needs?.files ?? []),
+ ...(variant && { variant }),
+ };
+}
+
+/**
+ * The files this worker runs a workflow with (src/lib/gpu/model-variants.ts pickFiles): a model variant made for its
+ * card's generation (gpuGen in its facts), else the workflow's own files, else another variant, by the files it verified
+ * and its VRAM. Null when it has the files of none, or too little VRAM. A worker program older than VARIANT_PROTOCOL
+ * gets the workflow's own files only.
+ */
+export function workerFiles(w: Pick<WorkerRow, "id" | "inventory_json" | "inventory_hash" | "facts_json" | "protocol">, workflowId: string): FileChoice | null {
+ const index = loadIndex();
+ const inv = inventoryOf(w);
+ const facts = json<ComputerFacts>(w.facts_json, {});
+ const vram = facts.vramBytes ?? 0;
+ const has = (key: FileKey) => {
+ const f = index.files[key];
+ return !!f && hasFile(inv, { folder: f.folder, name: f.file, size: f.sizeBytes, sha256: f.sha256 ?? null });
};
+ return pickFiles(fileChoices(index, workflowId), { gpuGen: facts.gpuGen ?? null, has, fits: (gb) => minVramBytesFor(gb) <= vram, variants: (w.protocol ?? 0) >= VARIANT_PROTOCOL });
}
/** How long a task should take on this worker: the lane's bench median there, or the task's own estimate. */
@@ -931,8 +979,10 @@ function fits(t: TaskRow, w: WorkerRow, now: number): boolean {
if (needs?.workflowId ? !cap.workflows.includes(needs.workflowId) : !cap.lanes.includes(lane)) return false;
// The files the run adds beyond its workflow's own (a look's LoRAs): only a worker that verified each one.
if (needs?.runtime?.length && !hasFiles(inventoryOf(w), needs.runtime)) return false;
- const vram = factsOf(w).vramBytes ?? 0;
- if ((needs?.minVramBytes ?? 0) > vram) return false;
+ // A workflow with model variants: the files (its own or a variant's) and the VRAM of the choice this worker would run.
+ if (needs?.workflowId && hasVariants(loadIndex(), needs.workflowId)) {
+ if (!workerFiles(w, needs.workflowId)) return false;
+ } else if ((needs?.minVramBytes ?? 0) > (factsOf(w).vramBytes ?? 0)) return false;
if (now - t.created_at < w.claim_after_ms + (allow[lane]?.delayMs ?? 0)) return false;
return true;
}
@@ -1526,6 +1576,7 @@ function ableWorkers(workflowId: string | null, o: { size?: Needs["size"]; ticke
if (workflowId === null) return cap.workflows.some((id) => poolLane(id) in allow && insideCeiling(ceiling, { workflowId: id, lane: poolLane(id) }));
if (!needs || !(lane! in allow) || !cap.workflows.includes(workflowId) || ceilingProblem(ceiling, { workflowId, lane, size: o.size })) return false;
if (o.files?.length && !hasFiles(inventoryOf(w), o.files)) return false;
+ if (hasVariants(loadIndex(), workflowId)) return !!workerFiles(w, workflowId);
return needs.minVramBytes <= (factsOf(w).vramBytes ?? 0);
});
}
diff --git a/src/server/computer/tasks.ts b/src/server/computer/tasks.ts
index fa9d155c..db68771c 100644
--- a/src/server/computer/tasks.ts
+++ b/src/server/computer/tasks.ts
@@ -294,7 +294,7 @@ export function logWorkerJob(
workerId: string | null,
now = Date.now(),
run: { execMs?: number; device?: string } = {},
- info: { why?: string; tries?: number } = {},
+ info: { why?: string; tries?: number; variant?: string } = {},
): void {
try {
const name = workerId ? ((rdb().prepare("SELECT name FROM relay_workers WHERE id = ?").get(workerId) as { name: string } | undefined)?.name ?? null) : null;
@@ -309,7 +309,7 @@ export function logWorkerJob(
console.warn(`[fuobe] Couldn't write the workers' log: ${(e as Error).message}`);
}
// The same handoff in the worker's timeline, in words (best-effort, as above).
- const detail = { ...(run.execMs !== undefined && { execMs: run.execMs }), ...(run.device && { device: run.device }), ...(info.why && { why: info.why }), ...(info.tries !== undefined && { tries: info.tries }) };
+ const detail = { ...(run.execMs !== undefined && { execMs: run.execMs }), ...(run.device && { device: run.device }), ...(info.why && { why: info.why }), ...(info.tries !== undefined && { tries: info.tries }), ...(info.variant && { variant: info.variant }) };
logWorkerEvent(
{ kind: "job", event, workerId, words: jobWords(event, t, { execMs: run.execMs, why: info.why, now }), taskId: t.id, generationId: t.generation_id, lane: t.lane ?? null, detail },
now,
diff --git a/tests/model-variants.test.ts b/tests/model-variants.test.ts
index a74d4e85..ef4285a7 100644
--- a/tests/model-variants.test.ts
+++ b/tests/model-variants.test.ts
@@ -35,7 +35,7 @@ const TE_INT8 = "text_encoders/qwen3vl_4b_int8_convrot.safetensors" as FileKey;
const VAE = "vae/qwen_image_vae.safetensors" as FileKey;
/** The committed inputs with model-variants.json replaced. */
-const build = (variants: unknown[]) => buildIndex({ ...loadInputs(LIBRARY), variants: { variants } });
+const build = (variants: object[]) => buildIndex({ ...loadInputs(LIBRARY), variants: { variants } });
const variant = (o: Record<string, unknown> = {}) => ({ id: "int8", gpuGen: { min: "8.0", max: "8.6" }, workflows: [KREA], files: { [FP8]: INT8 }, ...o });
describe("the catalog's variants (build-requirements.mjs)", () => {
@@ -163,7 +163,7 @@ describe("the graph with a variant's files (swapGraphFiles)", () => {
it("writes the variant's files into the loader inputs only, and leaves the graph it was given as it was", () => {
const before = JSON.stringify(graph);
- const withName = { ...graph, x: { class_type: "SaveImage", inputs: { filename_prefix: "krea2_turbo_fp8_scaled.safetensors" } } };
+ const withName: typeof graph = { ...graph, x: { class_type: "SaveImage", inputs: { filename_prefix: "krea2_turbo_fp8_scaled.safetensors" } } };
const out = swapGraphFiles(withName, swap, idx);
expect(out["10"].inputs.unet_name).toBe("krea2_turbo_int8_convrot.safetensors");
expect(out["11"].inputs.clip_name).toBe("qwen3vl_4b_int8_convrot.safetensors");
diff --git a/tests/pool-model-variants.test.ts b/tests/pool-model-variants.test.ts
new file mode 100644
index 00000000..95716aaf
--- /dev/null
+++ b/tests/pool-model-variants.test.ts
@@ -0,0 +1,210 @@
+import fs from "node:fs";
+import path from "node:path";
+import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
+import { tempDir } from "./helpers/temp-dir";
+
+/**
+ * Model variants on the workers (docs/gpu-workers.md, "Model variants"): a worker qualifies for a workflow with its own
+ * files or a variant's; the claim picks the variant made for its card (its gpuGen) when it has those files, and the job
+ * it hands out loads them (the owner's graph, swapped; an account's ticket, naming the variant). The task keeps the
+ * variant, so a worker that lost track of its task gets the same files again. A worker program older than protocol 5
+ * gets the workflow's own files only.
+ */
+
+vi.mock("next/server", async (importOriginal) => ({ ...(await importOriginal<typeof import("next/server")>()), connection: async () => {} }));
+
+const dir = tempDir("fuobe-pool-variants-");
+process.env.FUOBE_DATA_DIR = dir;
+process.env.COMFYUI_URL = "http://owner-comfy.test:8188";
+delete process.env.FUOBE_PASSWORD;
+
+const { db } = await import("@/server/db");
+const { resetRates } = await import("@/server/rate");
+const { setSetting } = await import("@/server/settings");
+const tasks = await import("@/server/computer/tasks");
+const pool = await import("@/server/computer/pool");
+const workers = await import("@/server/computer/workers");
+const { loadIndex } = await import("@/server/gpu/index-file");
+
+const KREA = "krea2-turbo-t2i";
+const FP8 = "diffusion_models/krea2_turbo_fp8_scaled.safetensors";
+const INT8 = "diffusion_models/krea2_turbo_int8_convrot.safetensors";
+const TE_FP8 = "text_encoders/qwen3vl_4b_fp8_scaled.safetensors";
+const TE_INT8 = "text_encoders/qwen3vl_4b_int8_convrot.safetensors";
+const VAE = "vae/qwen_image_vae.safetensors";
+const BASE = [FP8, TE_FP8, VAE];
+const VARIANT = [INT8, TE_INT8, VAE];
+const BOTH = [...BASE, INT8, TE_INT8];
+const GB = 2 ** 30;
+const VERSION = "c".repeat(64);
+const GRAPH = JSON.parse(fs.readFileSync(path.join(process.cwd(), "workflows/comfyui", `${KREA}.json`), "utf8"));
+let clock = Date.UTC(2026, 10, 2, 3, 0, 0);
+
+type W = { id: string; token: string };
+const row = (w: W) => workers.getWorker(w.id)!;
+
+/** The worker's verified files, as its inventory reports them. */
+const filesOf = (keys: string[]) =>
+ keys.map((k) => {
+ const f = loadIndex().files[k as keyof ReturnType<typeof loadIndex>["files"]];
+ return { folder: f.folder, name: f.file, size: f.sizeBytes, sha256: "a".repeat(64) };
+ });
+
+function beat(w: W, protocol: number) {
+ return pool.workerBeat(
+ row(w),
+ pool.cleanBeat({ device: `wkr-${w.id}`, protocol, version: "1.0.0", local: { paused: false, why: null, until: null }, gpu: {}, inventoryHash: null, running: [], stopped: [], catalogVersion: VERSION }),
+ clock,
+ );
+}
+
+/** A worker on, all day, allowed Krea 2's lane, with these files, this card generation and this worker program. */
+function worker(name: string, o: { files: string[]; gpuGen?: string; protocol?: number; vram?: number }): W {
+ const w = pool.addWorker(name);
+ pool.patchWorker(w.id, { paused: false, hours: { always: true }, allow: { [pool.poolLane(KREA)]: { delayMs: 0 } }, claimAfterMs: 0 });
+ beat(w, o.protocol ?? 5);
+ pool.saveInventory(row(w), { files: filesOf(o.files), nodePacks: [], media: ["image"] });
+ db().prepare("UPDATE relay_workers SET facts_json = ?, catalog_version = ? WHERE id = ?").run(JSON.stringify({ vramBytes: (o.vram ?? 24) * GB, ...(o.gpuGen && { gpuGen: o.gpuGen }) }), VERSION, w.id);
+ beat(w, o.protocol ?? 5);
+ return w;
+}
+
+let gens = 0;
+function generation() {
+ const gid = `gen-v-${++gens}`;
+ db()
+ .prepare("INSERT INTO generations (id, feature, model_id, engine, provider, op, kind, status, request_json, outputs_json, created_at, updated_at) VALUES (?, 'image', 'm', 'open', 'comfyui', 't2i', 'image', 'queued', '{}', '[]', ?, ?)")
+ .run(gid, clock, clock);
+ return gid;
+}
+
+/** The owner's own Krea 2 job: its catalog graph. */
+const ownerJob = () => placed(tasks.createTask({ principal: "owner", generationId: generation(), graph: GRAPH, workflowId: KREA, pool: pool.poolFields(KREA, {}, clock) }).id);
+
+/** A task made at the test's clock. */
+function placed(id: string) {
+ db().prepare("UPDATE relay_tasks SET created_at = ? WHERE id = ?").run(clock, id);
+ return id;
+}
+
+/** An account's Krea 2 run: a job ticket for this catalog. */
+const accountJob = () =>
+ placed(tasks.createTask({
+ principal: "acct:a1",
+ generationId: generation(),
+ graph: {},
+ ticket: { v: 1, workflowId: KREA, catalogVersion: VERSION, op: "t2i", settings: { prompt: "a portrait", seed: 1, numOutputs: 1 }, inputs: [], outputs: { count: 1, kind: "image" }, size: { megapixels: 1, seconds: 0, outputs: 1 } },
+ workflowId: KREA,
+ pool: pool.poolFields(KREA, { account: "a1", catalogVersion: VERSION }, clock),
+ }).id);
+
+const claim = (w: W, running: string[] = []) => pool.workerClaim(row(w), running, clock);
+const loads = (graph: unknown) => JSON.stringify(graph);
+const extraOf = (id: string) => JSON.parse((db().prepare("SELECT extra_json FROM relay_tasks WHERE id = ?").get(id) as { extra_json: string }).extra_json);
+
+beforeAll(() => setSetting("comfyWhere", "workers"));
+beforeEach(() => {
+ resetRates();
+ clock += 60 * 60_000;
+ db().prepare("DELETE FROM relay_workers").run();
+ db().prepare("UPDATE relay_tasks SET state = 'canceled' WHERE state IN ('waiting','sending','queued','running','collecting')").run();
+});
+
+describe("the files a worker gets a job with", () => {
+ it("a card the variant is made for runs it when it has its files: the owner's graph loads them", () => {
+ const id = ownerJob();
+ const w = worker("ampere", { files: BOTH, gpuGen: "8.6" });
+ const c = claim(w)!;
+ expect(c.id).toBe(id);
+ expect(c.variant).toBe("int8");
+ expect(loads(c.graph)).toContain("krea2_turbo_int8_convrot.safetensors");
+ expect(loads(c.graph)).toContain("qwen3vl_4b_int8_convrot.safetensors");
+ expect(loads(c.graph)).not.toContain("_fp8_scaled.safetensors");
+ expect(c.models?.map((m) => `${m.folder}/${m.name}`).sort()).toEqual([...VARIANT].sort());
+ // The task keeps the variant, and the workers' timeline says it.
+ expect(extraOf(id).variant).toBe("int8");
+ const ev = db().prepare("SELECT detail_json FROM worker_events WHERE worker_id = ? AND kind = 'job' ORDER BY id DESC LIMIT 1").get(w.id) as { detail_json: string } | undefined;
+ expect(JSON.parse(ev?.detail_json ?? "{}").variant).toBe("int8");
+ });
+
+ it("another card runs the workflow's own files when it has them", () => {
+ ownerJob();
+ const c = claim(worker("blackwell", { files: BOTH, gpuGen: "12.0" }))!;
+ expect(c.variant).toBeUndefined();
+ expect(c.graph).toEqual(GRAPH);
+ expect(c.models?.map((m) => `${m.folder}/${m.name}`).sort()).toEqual([...BASE].sort());
+ });
+
+ it("a worker with only a variant's files qualifies, and runs the variant whatever its card", () => {
+ const id = ownerJob();
+ expect(pool.workersCanRun(KREA)).toBe(false);
+ const w = worker("int8-only", { files: VARIANT, gpuGen: "12.0" });
+ expect(pool.workersCanRun(KREA)).toBe(true);
+ const c = claim(w)!;
+ expect(c.id).toBe(id);
+ expect(c.variant).toBe("int8");
+ expect(loads(c.graph)).toContain("krea2_turbo_int8_convrot.safetensors");
+ });
+
+ it("part of a variant's files is not enough", () => {
+ ownerJob();
+ expect(claim(worker("part", { files: [INT8, TE_FP8, VAE], gpuGen: "8.6" }))).toBeNull();
+ });
+
+ it("an account's ticket names the variant and its files; the workflow's own files name none", () => {
+ const id = accountJob();
+ const c = claim(worker("ampere-t", { files: BOTH, gpuGen: "8.6" }))!;
+ expect(c.id).toBe(id);
+ expect(c.ticket?.variant).toEqual({ id: "int8", files: { [FP8]: INT8, [TE_FP8]: TE_INT8 } });
+ expect(c.graph).toBeUndefined();
+ accountJob();
+ const other = claim(worker("ada-t", { files: BOTH, gpuGen: "8.9" }))!;
+ expect(other.ticket).toBeDefined();
+ expect("variant" in other.ticket!).toBe(false);
+ });
+
+ it("a worker that lost track of its task gets the same files again", () => {
+ const id = ownerJob();
+ const w = worker("lost", { files: BOTH, gpuGen: "8.6" });
+ expect(claim(w)?.variant).toBe("int8");
+ // Its files change meanwhile; the task it holds keeps the files it was taken with.
+ pool.saveInventory(row(w), { files: filesOf(BASE), nodePacks: [], media: ["image"] });
+ const again = claim(w, [])!;
+ expect(again.id).toBe(id);
+ expect(again.variant).toBe("int8");
+ expect(loads(again.graph)).toContain("krea2_turbo_int8_convrot.safetensors");
+ });
+});
+
+describe("an older worker program (before protocol 5)", () => {
+ it("gets the workflow's own files, even on the variant's card", () => {
+ ownerJob();
+ const c = claim(worker("older", { files: BOTH, gpuGen: "8.6", protocol: 4 }))!;
+ expect(c.variant).toBeUndefined();
+ expect(c.graph).toEqual(GRAPH);
+ accountJob();
+ const t = claim(worker("older-t", { files: BOTH, gpuGen: "8.6", protocol: 4 }))!;
+ expect("variant" in t.ticket!).toBe(false);
+ });
+
+ it("takes no job it has only a variant's files for, and no run counts it", () => {
+ ownerJob();
+ const w = worker("older-int8", { files: VARIANT, gpuGen: "8.6", protocol: 4 });
+ expect(claim(w)).toBeNull();
+ expect(pool.workersCanRun(KREA)).toBe(false);
+ });
+
+ it("a worker that doesn't say its card's generation gets the workflow's own files when it has them", () => {
+ ownerJob();
+ const c = claim(worker("no-gen", { files: BOTH }))!;
+ expect(c.variant).toBeUndefined();
+ expect(c.graph).toEqual(GRAPH);
+ });
+});
+
+describe("VRAM", () => {
+ it("a card with too little memory takes neither", () => {
+ ownerJob();
+ expect(claim(worker("small", { files: BOTH, gpuGen: "8.6", vram: 8 }))).toBeNull();
+ });
+});