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.

Worker: a face check that fails twice holds back face jobs only, not the whole worker

Adarsh348a963de75d
diff --git a/bin/lib/worker/run.mjs b/bin/lib/worker/run.mjs
index 10ea6a58..892727c4 100644
--- a/bin/lib/worker/run.mjs
+++ b/bin/lib/worker/run.mjs
@@ -327,6 +327,8 @@ async function work(saved, deps, owner) {
// Its ComfyUI lists the nodes of its face detector's self-check (self-check.mjs), and how many checks it ran.
let faceNodes = false;
let faceChecks = 0;
+ // When a face self-check last failed twice: face jobs go back in line until SELF_CHECK_PAUSE_MS later; other jobs go on.
+ let facesDownAt = null;
let answer = null;
let inv = { files: [], nodePacks: [], media: ffmpeg ? ["image", "video", "audio"] : ["image"] };
let packs = [];
@@ -505,11 +507,16 @@ async function work(saved, deps, owner) {
}
/**
* Its face detector's self-check (self-check.mjs) on its GPU ComfyUI, while that ComfyUI has the face nodes. A failure
- * starts its ComfyUI again and checks once more; a second failure pauses face work ("self-check") for
- * SELF_CHECK_PAUSE_MS (5 minutes). True when it passed, or when there is nothing to check.
+ * starts its ComfyUI again and checks once more; a second failure holds back face jobs only (they go back in line,
+ * "self-check") for SELF_CHECK_PAUSE_MS (5 minutes), while every other job goes on. True when it passed, or when there
+ * is nothing to check.
*/
async function checkFaces(when) {
if (!faceNodes || !comfy.ready) return true;
+ if (facesDownAt !== null) {
+ if (now() - facesDownAt < SELF_CHECK_PAUSE_MS) return false;
+ facesDownAt = null;
+ }
const once = () => runSelfCheck((url, init) => comfy.fetch(url, init), comfy.base, { n: ++faceChecks, now, sleep });
const read = (r) => `${r.height === null ? "no face" : `${Math.round(r.height)} px`} (${r.why}${r.detail ? `: ${r.detail}` : ""})`;
let first = await once();
@@ -548,9 +555,8 @@ async function work(saved, deps, owner) {
log(`Its face check passed after the restart (${Math.round(second.height)} px).`);
return true;
}
- comfyTrouble = "self-check";
- troubleAt = now();
- log(`Its face check failed again after the restart (${second.why}${second.detail ? `: ${second.detail}` : ""}): face jobs go back in line, and it checks again in ${Math.round(SELF_CHECK_PAUSE_MS / 60_000)} minutes.`);
+ facesDownAt = now();
+ log(`Its face check failed again after the restart (${second.why}${second.detail ? `: ${second.detail}` : ""}): face jobs go back in line for ${Math.round(SELF_CHECK_PAUSE_MS / 60_000)} minutes, then it checks again first; other jobs go on.`);
return false;
}
// One look at a time; the next beat carries a changed hash, and the studio then asks for the list.
@@ -1312,8 +1318,6 @@ async function work(saved, deps, owner) {
awake.set(!!answer?.worker && (busyJob || busyCpu || hold.ids().length > 0 || !!mayWork()));
// A taken port is tried again (a bind test, never a connection) once a minute.
if (comfyTrouble === "port-busy" && t - troubleAt >= 60_000) comfyTrouble = null;
- // A failed face self-check: five minutes later its ComfyUI starts again, and checks again first.
- if (comfyTrouble === "self-check" && t - troubleAt >= SELF_CHECK_PAUSE_MS) comfyTrouble = null;
const s = state();
if (s !== lastState) {
lastState = s;
diff --git a/docs/gpu-workers.md b/docs/gpu-workers.md
index 4001bde5..4b9a453f 100644
--- a/docs/gpu-workers.md
+++ b/docs/gpu-workers.md
@@ -748,8 +748,10 @@ takes about a second.
`H3FaceSelect`. It checks only when its ComfyUI lists `H3FaceTrackCrop` and `PreviewAny`.
- When a check fails, the worker starts its ComfyUI again and checks once more.
- When the second check fails too, the job goes back in line with its place kept, and the try does not count against
- it (give-back `self-check`). The worker pauses itself (`local.why: "self-check"`), and Settings → Workers shows that
- its face check didn't pass. After an hour, the worker starts its ComfyUI again, and the check runs again first.
+ it (give-back `self-check`). For 5 minutes after that, every face job it is given goes back in line the same way,
+ without a check. Every other job goes on as usual: its ComfyUI keeps running. After the 5 minutes, the next face job
+ checks again first. (A worker program from before this rule paused itself instead, `local.why: "self-check"`, and
+ Settings → Workers showed that its face check didn't pass.)
After each job, however it ended, nothing of it stays in its ComfyUI: the worker empties the queue, stops a prompt that
still runs, and clears the whole history (a meta-batch's passes too). It also deletes the job's inputs and results from
@@ -1099,8 +1101,8 @@ its target), at most once an hour each.
and waits as a job no worker took (its wait limit holds, unless a worker ran it before). Refused later on (a worker
that started again after an update and took its own job back), it counts as an attempt, and the job keeps its
claim's time.
- With `self-check` (the worker's face self-check failed twice, and it paused itself), the job goes back in line with
- its place kept, and the try costs no attempt.
+ With `self-check` (the worker's face self-check failed twice, so it holds back face jobs for a while), the job goes
+ back in line with its place kept, and the try costs no attempt.
- `failed` can also give `unknown-node`, `unsafe-path` (a path, or an input outside its rule), `model-unverified`,
`input-crashed` (its ComfyUI stopped twice on the job), `input-unreadable` (ffmpeg could not read a clip or a
sound), `bad-ticket` (a ticket it can't use, or a graph where a ticket belongs), `unsafe-model` (a 3D model that