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.

Hosted runs: a chain's later step that needs a card this install's GPUs lack is refused before Run

Adarshcf13e6209e41
diff --git a/src/server/hosted-run.ts b/src/server/hosted-run.ts
index 531444c9..b01fbe54 100644
--- a/src/server/hosted-run.ts
+++ b/src/server/hosted-run.ts
@@ -135,13 +135,14 @@ export function poolSteps(accountId: string, req: GenerationRequest): PlannedSte
/**
* The first step of a run that this install's GPUs may not take under the policy (its model or app not offered, a kind
* the policy leaves out, a model no worker is allowed, a cloud model, a text step or one made in the browser: steps that
- * can't run there), in words; null when every step may run there. A light ComfyUI step (a join) costs nothing and every
- * policy allows it, but it still runs there: something there must take it, or the run's other steps would finish and
- * their join would wait for nothing.
+ * can't run there, a model their card can't run), in words; null when every step may run there. A light ComfyUI step (a
+ * join) costs nothing and every policy allows it, but it still runs there: something there must take it, or the run's
+ * other steps would finish and their join would wait for nothing.
*/
export function stepsProblem(p: Policy, steps: PlannedStep[]): string | null {
for (const s of steps) {
if (!poolRunsProvider(s.provider)) return HOSTED_WORDS.notOffered;
+ if (s.provider === "comfyui" && poolCardRefuses(s.modelId)) return HOSTED_WORDS.rtxCard;
if (freeStep(s)) {
if (s.provider === "comfyui" && !poolTakes(stepEndpoint(s))) return HOSTED_WORDS.notOffered;
continue;
@@ -210,7 +211,8 @@ export function poolGate(
}
// Every step of a chain, not only its first: each one the policy must allow, and the run is priced for all of them.
const steps = planSteps();
- if (steps && p && stepsProblem(p, steps)) return { ok: false, reason: "notOffered" };
+ const problem = steps && p ? stepsProblem(p, steps) : null;
+ if (problem) return { ok: false, reason: problem === HOSTED_WORDS.rtxCard ? "rtxCard" : "notOffered" };
return { ok: true, steps };
}
diff --git a/tests/pool-limits.test.ts b/tests/pool-limits.test.ts
index 448a55af..15ad6758 100644
--- a/tests/pool-limits.test.ts
+++ b/tests/pool-limits.test.ts
@@ -709,7 +709,14 @@ describe("the price check before Run and the run itself", async () => {
setSetting("comfyWhere", "");
expect(hostedRun.poolCardRefuses("oss-rtx-video-upscale")).toBe(true);
expect(hostedRun.poolCardRefuses("oss-z-image-turbo")).toBe(false);
+ // A chain's later step too, before Run, in the same words (an upscale on the card after a clip, say).
+ const chain = [
+ { id: "s0", modelId: "oss-z-image-turbo", op: "t2i", provider: "comfyui", kind: "image", presetId: null, waits: false },
+ { id: "s1", modelId: "oss-rtx-video-upscale", op: "upscale-video", provider: "comfyui", kind: "video", presetId: null, waits: true },
+ ];
+ expect(hostedRun.stepsProblem(billing.OPEN_POLICY, chain)).toBe(HOSTED_WORDS.rtxCard);
setSetting("comfyWhere", "workers");
+ expect(hostedRun.stepsProblem(billing.OPEN_POLICY, chain)).not.toBe(HOSTED_WORDS.rtxCard);
// A guest is told it isn't offered, with nowhere to connect a GPU named.
expect(hostedRun.gateWords("rtxCard", true)).toBe(HOSTED_GUEST_WORDS.rtxCard);
expect(hostedRun.gateWords("rtxCard", true)).not.toMatch(/Settings|your own GPU|NVIDIA/);