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.

Runs on this install's GPUs: held runs keep their release place, tests follow main's newer rules

Adarsh83c930bf1156
diff --git a/docs/public-signup.md b/docs/public-signup.md
index 196d003b..025273fe 100644
--- a/docs/public-signup.md
+++ b/docs/public-signup.md
@@ -909,10 +909,9 @@ With it on:
7 h" before Run, "In line · starts in about 7 h" on the tile; at the renewal the runs enter at their press-time
places, in press order;
- the billing service doesn't answer within 5 s of the press (or the moderation service doesn't, at a studio's
- press), or a run was cut off between its row and its GPU task (a deploy, a crash): its tile shows its place as if
- in line, it reserves (and is checked) under its press's own request id once the service answers, and enters at its
- press-time place. While the service says runs
- here are paused, the line before Run shows its words, and a press waits ("In line · starts when a GPU is free");
+ press): its tile shows its place as if in line, it reserves (and is checked) under its press's own request id once
+ the service answers, and enters at its press-time place. While the service says runs here are paused, the line
+ before Run shows its words, and a press waits ("In line · starts when a GPU is free");
- an hourly limit or free generations that renew (credits on): it starts at that time, at the back of the line.
Holds are kept in SQLite (`pool_holds`) with a lease per run, so they survive a deploy, a restart and two app
diff --git a/src/server/computer/pool.ts b/src/server/computer/pool.ts
index 9f3b214a..7806796a 100644
--- a/src/server/computer/pool.ts
+++ b/src/server/computer/pool.ts
@@ -1106,6 +1106,7 @@ const SAME_PRESS = "(CASE WHEN @hold IS NOT NULL THEN json_extract(g.request_jso
* its job was made (a restart or a deploy: generations.ts sendAgainOnWorkers).
* - `started`: a worker took one of those jobs. The run's wait limit no longer applies then (it applies only before the
* run's first start).
+ * - `placed`: one of those jobs exists (else `rankAt` is the time the run was made).
* - `later`: the row is a later step of its run (it waits for a step the same press made). It has no wait limit: its run
* was taken in line already, so it waits at the run's place for as long as it takes.
*
@@ -1113,7 +1114,7 @@ const SAME_PRESS = "(CASE WHEN @hold IS NOT NULL THEN json_extract(g.request_jso
* the run started. Only steps the same press made count (the same billing hold; with none, the same batch): a result
* kept from an earlier run that a step uses gives it neither that run's place nor its start. Null: no such row.
*/
-export function runPlaceOf(generationId: string): { class: "paid" | "free"; rankAt: number | null; started: boolean; later: boolean } | null {
+export function runPlaceOf(generationId: string): { class: "paid" | "free"; rankAt: number | null; placed: boolean; started: boolean; later: boolean } | null {
const d = db();
const g = d
.prepare(
@@ -1150,6 +1151,7 @@ export function runPlaceOf(generationId: string): { class: "paid" | "free"; rank
return {
class: g.cls === "paid" ? "paid" : "free",
rankAt: jobs[0]?.rank_at ?? g.created_at - boost,
+ placed: jobs.length > 0,
started: jobs.some((t) => t.claimed_at !== null),
later,
};
diff --git a/src/server/generations.ts b/src/server/generations.ts
index ec757f03..796f377a 100644
--- a/src/server/generations.ts
+++ b/src/server/generations.ts
@@ -3624,7 +3624,8 @@ export function sendHeld(id: string, job: number, rankAt?: number): boolean {
return false;
}
submitting().add(id);
- void submit(id, p.route, p.providerId, p.plan, p.req, job, undefined, rankAt);
+ // (Its place: its press, or now, at the back; never the time its row was made, which pool.ts runPlaceOf gives a run.)
+ void submit(id, p.route, p.providerId, p.plan, p.req, job, undefined, rankAt ?? Date.now());
return true;
}
diff --git a/src/server/pool-holds.ts b/src/server/pool-holds.ts
index 0fcb7b66..298cc6a1 100644
--- a/src/server/pool-holds.ts
+++ b/src/server/pool-holds.ts
@@ -11,8 +11,8 @@ import { endLease, leaseToken, MINE_NOW, takeLease } from "./run-leases";
* Why a run waits (`reason`):
* - `mine`: the account already has its runs at once in line (the policy's `activeRuns`); it enters when one of them ends.
* - `today`: the day's GPU time is used up (the billing service's `startAt`); it enters at the renewal.
- * - `service`: the billing or moderation service didn't answer at the press (or said runs are paused), or the run was
- * cut off between its rows and its GPU task (a deploy, a crash); it reserves (and is checked) once the service answers.
+ * - `service`: the billing or moderation service didn't answer at the press (or said runs are paused); it reserves (and
+ * is checked) once the service answers.
* - `hour`: an hourly limit; it enters at `start_at`.
* - `list`: the waiting list (only when the service has one switched on).
* - `credits`: no free generations left until they renew at `start_at` (credits on).
diff --git a/src/server/providers/comfyui.ts b/src/server/providers/comfyui.ts
index c5a671ac..219f2b26 100644
--- a/src/server/providers/comfyui.ts
+++ b/src/server/providers/comfyui.ts
@@ -294,9 +294,10 @@ export const POOL_NOT_LOCAL = "This install's ComfyUI address isn't on this mach
function accountPoolFields(workflowId: string, account: string, generationId: string | undefined, o: { size: NonNullable<Parameters<typeof poolFields>[1]>["size"]; catalogVersion?: string }) {
const stamp = runStamp();
const run = generationId ? runPlaceOf(generationId) : null;
- // A run that waited to enter the line for the system's reasons (the day's GPU time, a quiet service) enters at its
- // press, with its head start (pool-holds.ts).
- const pressed = run?.rankAt == null && stamp?.rankAt !== undefined ? stamp.rankAt - Math.max(0, Math.min(stamp.boostMs ?? 0, 24 * 60 * 60_000)) : undefined;
+ // A run that waited to enter the line (pool-holds.ts) enters where its release says (stamp.rankAt): for the system's
+ // reasons (the day's GPU time, a quiet service) at its press, behind its own runs at the time it is sent; with its
+ // head start. Only while no job of its run has a place yet.
+ const pressed = !run?.placed && stamp?.rankAt !== undefined ? stamp.rankAt - Math.max(0, Math.min(stamp.boostMs ?? 0, 24 * 60 * 60_000)) : undefined;
return poolFields(workflowId, {
account,
class: stamp?.class ?? "free",
diff --git a/tests/comfy-provider.test.ts b/tests/comfy-provider.test.ts
index b3d27fab..3d26bafd 100644
--- a/tests/comfy-provider.test.ts
+++ b/tests/comfy-provider.test.ts
@@ -724,3 +724,25 @@ describe("round-3 workflow bindings", () => {
await expect(prepare("captions-burnin", { prompt: "no timings here" })).rejects.toThrow(/No timed captions/);
});
});
+
+describe("a model file an account's GPU lacks, as its run says it", () => {
+ it("names the file's title, size and folder, with Fix it and Check again", async () => {
+ const { onOwnGpu, promptRefusal } = await import("@/server/providers/comfyui");
+ const body = {
+ error: { type: "prompt_outputs_failed_validation", message: "Prompt outputs failed validation" },
+ node_errors: {
+ "12": {
+ class_type: "LoraLoaderModelOnly",
+ errors: [{ type: "value_not_in_list", message: "Value not in list: lora_name: 'minimax_h3_flf2v_lora_v1.safetensors' not in []", extra_info: { received_value: "minimax_h3_flf2v_lora_v1.safetensors" } }],
+ },
+ },
+ };
+ const r = onOwnGpu({ url: "https://pod.example.com" }, () => promptRefusal(body, 400, getWorkflow("minimax-h3-orbit").manifest, []));
+ expect(r.fix?.code).toBe("comfy_missing_model");
+ expect(r.message).toContain("Orbit LoRA");
+ expect(r.message).toContain("minimax_h3_flf2v_lora_v1.safetensors");
+ expect(r.message).toContain("155 MB");
+ expect(r.message).toContain("ComfyUI/models/loras");
+ expect(r.message).toMatch(/Press Fix it to get it, then Check again\.$/);
+ });
+});
diff --git a/tests/engine-mode.test.ts b/tests/engine-mode.test.ts
index e400576a..db021552 100644
--- a/tests/engine-mode.test.ts
+++ b/tests/engine-mode.test.ts
@@ -174,13 +174,14 @@ describe("the engine switch a studio starts on", () => {
const rescue = down.actions.find((a) => a.kind === "run-with-key")!;
expect(rescue).toEqual(withKeyAction("fal", "minimax-h3", "i2v"));
const request = { feature: "video", modelId: h3.id, engine: "open" as const, prompt: "a fast pass over the cliffs", params: { extra: { graph: 1 } } };
- expect(onCloudKey(request as never, rescue)).toEqual({ feature: "video", modelId: "minimax-h3", engine: "cloud", op: "i2v", prompt: "a fast pass over the cliffs", params: {} });
+ expect(onCloudKey(request as never, rescue)).toEqual({ feature: "video", modelId: "minimax-h3", engine: "cloud", op: "i2v", prompt: "a fast pass over the cliffs", params: {}, prefer: "fal" });
// Nothing was written: the next run starts on the switch as it was.
expect(storage.map.size).toBe(0);
expect(api.readEngine(ana)).toBe("open");
- // The composer: while hosted, the press sends this run on the key; the switch moves to Cloud only with hosted runs off.
+ // The composer: while hosted, the press sends this run on the key through Run (at the price it showed); with hosted
+ // runs off it runs once on the key too (runOnceWithKey), and the switch stays where it was.
const composer = readFileSync("src/components/studio/composer.tsx", "utf8");
- expect(composer).toMatch(/const onRunWithKey = viewerInfo\?\.hosted\s+\? \(a: TroubleAction\) => submitRef\.current\(undefined, a\)\s+: \(\) => \{\s+setEngine\("cloud"\);\s+setCloudRun\(true\);/);
+ expect(composer).toMatch(/const onRunWithKey = viewerInfo\?\.hosted \? \(a: TroubleAction\) => submitRef\.current\(undefined, a\) : runOnceWithKey;/);
expect(composer).toMatch(/const onKey = withKey \? onCloudKey\(withVoiceFirst, withKey\) : withVoiceFirst;/);
expect(composer).toMatch(/onClick=\{\(\) => \(viewerInfo\?\.hosted \? engineForNextPage\("cloud"\) : setEngine\("cloud"\)\)\}/);
});
diff --git a/tests/golden/self-host/feed-tiles.html b/tests/golden/self-host/feed-tiles.html
index 963ab4e0..119fd5d4 100644
--- a/tests/golden/self-host/feed-tiles.html
+++ b/tests/golden/self-host/feed-tiles.html
@@ -46,12 +46,12 @@
</div>
<div class="flex h-full max-w-full flex-col justify-between rounded-xl border border-dashed bg-background p-3" style="aspect-ratio:1">
-<div class="min-h-0 space-y-1 overflow-hidden">
-<p class="text-[13px] font-medium">Couldn&#x27;t generate this one</p>
-<p class="line-clamp-5 text-[12px] leading-snug break-words whitespace-pre-line text-muted-foreground">Your GPU ran out of memory. Try a smaller size or a shorter clip.</p>
+<div class="flex min-h-0 flex-col gap-1 overflow-hidden">
+<p class="shrink-0 text-[13px] font-medium">Couldn&#x27;t generate this one</p>
+<p class="shrink-0 text-[12px] leading-snug break-words whitespace-pre-line text-muted-foreground line-clamp-4">Your GPU ran out of memory. Try a smaller size or a shorter clip.</p>
</div>
-<div class="mt-2 flex flex-wrap gap-1.5">
-<button class="inline-flex h-7 w-fit items-center gap-1.5 rounded-full bg-secondary px-2.5 text-[12px] font-medium hover:bg-accent">
+<div class="mt-2 flex shrink-0 flex-wrap gap-1.5">
+<button class="inline-flex h-7 w-fit items-center gap-1.5 rounded-full bg-secondary px-2.5 text-[12px] font-medium hover:bg-accent disabled:opacity-70">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-ccw size-3" aria-hidden="true">
<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8">
</path>
@@ -62,11 +62,11 @@
</div>
<div class="flex h-full max-w-full flex-col justify-between rounded-xl border border-dashed bg-background p-3" style="aspect-ratio:1">
-<div class="min-h-0 space-y-1 overflow-hidden">
-<p class="text-[13px] font-medium">Canceled</p>
+<div class="flex min-h-0 flex-col gap-1 overflow-hidden">
+<p class="shrink-0 text-[13px] font-medium">Canceled</p>
</div>
-<div class="mt-2 flex flex-wrap gap-1.5">
-<button class="inline-flex h-7 w-fit items-center gap-1.5 rounded-full bg-secondary px-2.5 text-[12px] font-medium hover:bg-accent">
+<div class="mt-2 flex shrink-0 flex-wrap gap-1.5">
+<button class="inline-flex h-7 w-fit items-center gap-1.5 rounded-full bg-secondary px-2.5 text-[12px] font-medium hover:bg-accent disabled:opacity-70">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-ccw size-3" aria-hidden="true">
<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8">
</path>
diff --git a/tests/golden/self-host/feed.html b/tests/golden/self-host/feed.html
index 34791230..0c5a6be4 100644
--- a/tests/golden/self-host/feed.html
+++ b/tests/golden/self-host/feed.html
@@ -262,12 +262,12 @@
<div class="flex flex-wrap gap-2">
<div class="h-56 max-w-full sm:h-64">
<div class="flex h-full max-w-full flex-col justify-between rounded-xl border border-dashed bg-background p-3" style="aspect-ratio:1">
-<div class="min-h-0 space-y-1 overflow-hidden">
-<p class="text-[13px] font-medium">Couldn&#x27;t generate this one</p>
-<p class="line-clamp-5 text-[12px] leading-snug break-words whitespace-pre-line text-muted-foreground">ComfyUI isn&#x27;t answering. Start it again, and Fuobe goes on by itself.</p>
+<div class="flex min-h-0 flex-col gap-1 overflow-hidden">
+<p class="shrink-0 text-[13px] font-medium">Couldn&#x27;t generate this one</p>
+<p class="shrink-0 text-[12px] leading-snug break-words whitespace-pre-line text-muted-foreground line-clamp-4">ComfyUI isn&#x27;t answering. Start it again, and Fuobe goes on by itself.</p>
</div>
-<div class="mt-2 flex flex-wrap gap-1.5">
-<button class="inline-flex h-7 w-fit items-center gap-1.5 rounded-full bg-secondary px-2.5 text-[12px] font-medium hover:bg-accent">
+<div class="mt-2 flex shrink-0 flex-wrap gap-1.5">
+<button class="inline-flex h-7 w-fit items-center gap-1.5 rounded-full bg-secondary px-2.5 text-[12px] font-medium hover:bg-accent disabled:opacity-70">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-ccw size-3" aria-hidden="true">
<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8">
</path>
diff --git a/tests/golden/self-host/library-cover.html b/tests/golden/self-host/library-cover.html
index 1ef80288..26dcc51d 100644
--- a/tests/golden/self-host/library-cover.html
+++ b/tests/golden/self-host/library-cover.html
@@ -1,7 +1,7 @@
<div class="relative size-full bg-muted">
<div class="skeleton-sweep absolute inset-0 animate-skeleton">
</div>
-<div class="absolute inset-x-0 bottom-0 p-3">
+<div class="absolute inset-x-0 bottom-0 space-y-1 p-3">
<p class="shimmer-text animate-shimmer-text truncate text-[13px] font-medium">Queued</p>
<p class="font-mono text-[11px] text-muted-foreground">1m 30s</p>
</div>
@@ -10,21 +10,21 @@
<div class="relative size-full bg-muted">
<div class="skeleton-sweep absolute inset-0 animate-skeleton">
</div>
-<div class="absolute inset-x-0 bottom-0 p-3">
+<div class="absolute inset-x-0 bottom-0 space-y-1 p-3">
<p class="shimmer-text animate-shimmer-text truncate text-[13px] font-medium">Generating</p>
<p class="font-mono text-[11px] text-muted-foreground">42% · 1m 30s</p>
</div>
</div>
-<div class="flex size-full flex-col justify-between border border-dashed bg-background p-3">
-<div class="min-h-0 space-y-1 overflow-hidden">
-<p class="text-[13px] font-medium">Couldn&#x27;t generate this one</p>
-<p class="line-clamp-4 text-[12px] leading-snug break-words text-muted-foreground">Your GPU ran out of memory. Try a smaller size or a shorter clip.</p>
+<div class="flex size-full flex-col justify-between gap-2 border border-dashed bg-background p-3">
+<div class="flex min-h-0 flex-col gap-1 overflow-hidden">
+<p class="shrink-0 text-[13px] font-medium">Couldn&#x27;t generate this one</p>
+<p class="line-clamp-3 text-[12px] leading-snug break-words text-muted-foreground @[16rem]:line-clamp-4">Your GPU ran out of memory. Try a smaller size or a shorter clip.</p>
</div>
</div>
-<div class="flex size-full flex-col justify-between border border-dashed bg-background p-3">
-<div class="min-h-0 space-y-1 overflow-hidden">
-<p class="text-[13px] font-medium">Canceled</p>
+<div class="flex size-full flex-col justify-between gap-2 border border-dashed bg-background p-3">
+<div class="flex min-h-0 flex-col gap-1 overflow-hidden">
+<p class="shrink-0 text-[13px] font-medium">Canceled</p>
</div>
</div>
\ No newline at end of file
diff --git a/tests/golden/self-host/words.json b/tests/golden/self-host/words.json
index 3966c4ec..d989b2e0 100644
--- a/tests/golden/self-host/words.json
+++ b/tests/golden/self-host/words.json
@@ -676,6 +676,7 @@
"uploadStalled": "The upload stopped arriving. Check your connection, then try again.",
"diskLow": "Uploads are paused for a moment. Please try again shortly.",
"activeRuns": "You have 4 runs going. Start the next one when one finishes.",
+ "waitingRuns": "You have 4 runs waiting for your GPU. Cancel one, or run one with your key, to start another.",
"runRate": "That's a lot of runs this hour. Try again later.",
"finishRate": "That's a lot of finished pictures this hour. Try again later.",
"finishBusy": "Your last pictures are still being saved. Try again in a moment.",
diff --git a/tests/own-graceful-ui.test.ts b/tests/own-graceful-ui.test.ts
index 4523d5a0..131f1a37 100644
--- a/tests/own-graceful-ui.test.ts
+++ b/tests/own-graceful-ui.test.ts
@@ -97,14 +97,16 @@ describe("the check before Run while hosted runs are on", () => {
});
it("a key's offer says its price, and with no price known it isn't made", () => {
const priced = gpuBeforeRun({ ...base, viewer: account(offline, ["fal"]), site: place, keyPrice: "≈ $0.20" })!;
- expect(priced.actions.at(-1)).toEqual(withKeyAction("fal", "minimax-h3", "i2v", "≈ $0.20"));
- expect(priced.actions.at(-1)?.label).toBe("Run with your fal.ai key · ≈ $0.20");
+ // Run on <the place> first, then the first fix, then the key's run.
+ expect(priced.actions.map((a) => a.kind)).toEqual(["run-on-site", "start-gpu", "run-with-key", "check-gpu", "gpu-settings"]);
+ expect(priced.actions[2]).toEqual(withKeyAction("fal", "minimax-h3", "i2v", "≈ $0.20"));
+ expect(priced.actions[2].label).toBe("Run with your fal.ai key · ≈ $0.20");
expect(gpuBeforeRun({ ...base, viewer: account(offline, ["fal"]), site: place })!.actions.map((a) => a.kind)).not.toContain("run-with-key");
});
it("hosted runs off: the same buttons as before (no place, the key's offer without a price)", () => {
const off = gpuBeforeRun({ viewer: account(offline, ["fal"]), model: h3, engine: "open", preset: fpv, has, getModel, keyPrice: "≈ $0.20" })!;
- expect(off.actions.map((a) => a.kind)).toEqual(["start-gpu", "check-gpu", "gpu-settings", "run-with-key"]);
- expect(off.actions.at(-1)?.label).toBe("Run with your fal.ai key");
+ expect(off.actions.map((a) => a.kind)).toEqual(["start-gpu", "run-with-key", "check-gpu", "gpu-settings"]);
+ expect(off.actions[1].label).toBe("Run with your fal.ai key");
});
it("Run on <the place> shows only where the page can send the run there", () => {
const actions = [{ kind: "run-on-site" as const, label: "Run on Studio North GPUs" }, ...stopped.actions];
@@ -171,6 +173,22 @@ describe("the buttons", () => {
expect(html).toContain(end.words.replaceAll("'", "&#x27;"));
});
+ it("a failed tile offers no Retry where only a fix on the GPU helps (a known ComfyUI problem, a missing model file)", () => {
+ const tile = (cause: string, actions: { kind: string; label: string; target?: string }[]) =>
+ render(
+ createElement(FailedTile, {
+ g: { id: `g-${cause}`, status: "failed", error: "It stopped.", trouble: { cause, actions }, outputs: [], createdAt: Date.now(), request: { feature: "image", modelId: "oss-qwen-image" }, modelId: "oss-qwen-image", op: "t2i" } as never,
+ ratio: 16 / 9,
+ onRetry: () => {},
+ }),
+ );
+ const known = tile("gpu-comfy-known", [{ kind: "update-comfy", label: "How to update ComfyUI", target: "https://docs.comfy.org/installation/update_comfyui" }]);
+ expect(known).toContain("How to update ComfyUI");
+ expect(known).not.toContain("Retry");
+ expect(tile("gpu-model-file", [{ kind: "check-gpu", label: "Check my GPU" }])).not.toContain("Retry");
+ expect(tile("gpu-job-error", [{ kind: "check-gpu", label: "Check my GPU" }])).toContain("Retry");
+ });
+
it("a model file its GPU can't read: the tile and the Library card name it, with Get the file (a new tab) and Check my GPU", () => {
const VAE = "minimax_h3_video_vae_int8_convrot.safetensors";
const url = "https://huggingface.co/Kijai/MiniMax-H3-experimental/resolve/f5c3b1d5a63e008a691fca1b6096fd57a5307536/minimax_h3_video_vae_int8_convrot.safetensors";
diff --git a/tests/pool-holds.test.ts b/tests/pool-holds.test.ts
index a403022c..6edc92e7 100644
--- a/tests/pool-holds.test.ts
+++ b/tests/pool-holds.test.ts
@@ -9,8 +9,9 @@ import { tempDir } from "./helpers/temp-dir";
* press makes one run, always. A press past the account's runs at once is taken and enters at the back when one of them
* ends (so ten fast presses never pass another account); the day's GPU time used up keeps runs back until it renews,
* then they enter in press order; a press while the billing service doesn't answer is taken and reserves once it is
- * back, at its press-time place; a run cut off between its row and its GPU task waits again instead of failing; only a
- * press past the cap on runs waiting is refused. Leases keep two app processes from releasing one run twice.
+ * back, at its press-time place; a run cut off between its row and its GPU task is sent again in its place (and ends
+ * instead when a task was made for it); only a press past the cap on runs waiting is refused. Leases keep two app
+ * processes from releasing one run twice.
*/
vi.mock("next/server", async (importOriginal) => ({ ...(await importOriginal<typeof import("next/server")>()), connection: async () => {} }));
@@ -549,7 +550,7 @@ describe("a deploy or crash between a run's row and its GPU task (C5, A18)", ()
expect(t!.rank_at).toBeLessThanOrEqual(at);
});
- it("a GPU task made for the row whose id never reached it stops, so the row runs once", async () => {
+ it("a GPU task made for the row whose id never reached it is never sent twice: the row ends, and that task stops", async () => {
const a = account();
const made = await press(a.cookie);
const first = await until(() => taskOf(idOf(made)));
@@ -570,10 +571,12 @@ describe("a deploy or crash between a run's row and its GPU task (C5, A18)", ()
d.prepare("UPDATE orphan_task SET id = ?, generation_id = ?, state = 'waiting', created_at = ?, rank_at = ?").run(orphan, id, at, at);
d.exec("INSERT INTO relay_tasks SELECT * FROM orphan_task; DROP TABLE orphan_task");
})();
- const fresh = () => d.prepare("SELECT id FROM relay_tasks WHERE generation_id = ? AND id != ? AND state != 'canceled'").get(id, orphan) as { id: string } | undefined;
- expect(await until(fresh), "a new GPU task for the row").toBeTruthy();
+ // (A worker may have taken that task already: the row is never sent again, as for any run on the workers.)
+ const status = () => (d.prepare("SELECT status FROM generations WHERE id = ?").get(id) as { status: string }).status;
+ expect(await until(() => status() === "failed"), "the row ends").toBe(true);
expect((d.prepare("SELECT state FROM relay_tasks WHERE id = ?").get(orphan) as { state: string }).state).toBe("canceled");
- expect(getGeneration(id)!.status).not.toBe("failed");
+ const fresh = d.prepare("SELECT id FROM relay_tasks WHERE generation_id = ? AND id != ?").get(id, orphan) as { id: string } | undefined;
+ expect(fresh, "no second GPU task for the row").toBeUndefined();
});
});