comfyui node: the heartbeat prints per completed step, not per poll

The 3 s poll must stay -- a plain HTTP client learns nothing unsolicited
(the API pushes no step events) and the progress bar/completion detect
need it -- but the CONSOLE LINE now rides the step counter: printed when
(steps_done or status/progress) moves, or every 30 s as a keep-alive so
encoding and stalls never go silent. A 26-step job logs 27 lines instead
of ~135 near-duplicates, mirroring the server's per-step RAD_INFO rhythm.
The pace tracker keeps sampling every poll regardless of printing.
This commit is contained in:
gearwave00001 committed 2026-10-25 04:53:37 -05:00
1 parent feaf008927
commit 88540cd263
2 files changed
+38 -21

No files matched your search

@@ -137,15 +137,18 @@ the `input/` folder.
copy). copy).
- **job id** — the server-side job id, for `GET /v1/videos/<id>` or curl replay. - **job id** — the server-side job id, for `GET /v1/videos/<id>` or curl replay.
While a job runs the node polls every 3 s, drives ComfyUI's node progress bar, While a job runs the node polls every 3 s and drives ComfyUI's node progress
**and prints a live line to the ComfyUI console** — bar, and **prints a live line to the ComfyUI console once per completed step**
(a keep-alive every 30 s covers encoding and any stall) —
`[RadianceMiniMax] job_x: 45%, step 12/26, 5.2 s/step, eta ~1m 07s (+decode), `[RadianceMiniMax] job_x: 45%, step 12/26, 5.2 s/step, eta ~1m 07s (+decode),
elapsed 55s` — so a waiting user sees pace and progress, not a silent spinner. elapsed 55s` — mirroring the server's own per-step log, so a waiting user sees
The `s/step` is **measured between polls** from the step counter and lightly pace and progress, not a silent spinner and not a poll-spammed wall of nearly
smoothed, so it tracks the live pace — including the step-price jump when a identical lines. The `s/step` is **measured over ≥2-step windows** from the
latent-upscaled job switches from draft to refine grid — and the eta is step counter and lightly smoothed, so it tracks the live pace — including the
remaining steps × that pace (the `+decode` tail is extra, as on the server's step-price jump when a latent-upscaled job switches from draft to refine grid
own log). Real step counts come from a radiance server built after Oct 2026 — and the eta is remaining steps × that pace (the `+decode` tail is extra, as
on the server's own log). Polling is unavoidable (the HTTP API pushes nothing);
*printing* is event-driven off the step counter. Real step counts come from a radiance server built after Oct 2026
(it added `steps_done`/`steps_total` to the job object); an older server shows (it added `steps_done`/`steps_total` to the job object); an older server shows
`~step` derived from the job's `progress` field, which is the steps' share of `~step` derived from the job's `progress` field, which is the steps' share of
0..90 by design, and extrapolates its eta from that progress. That same new 0..90 by design, and extrapolates its eta from that progress. That same new
@@ -39,6 +39,7 @@ from comfy_api.latest import io, ui, Types
from comfy_api.input_impl import VideoFromFile from comfy_api.input_impl import VideoFromFile
POLL_SECONDS = 3.0 POLL_SECONDS = 3.0
KEEPALIVE_SECONDS = 30.0
LOG = "RadianceMiniMax" LOG = "RadianceMiniMax"
# The size law the minimaxh3 plugin declares (arch/minimaxh3/minimaxh3.cpp): # The size law the minimaxh3 plugin declares (arch/minimaxh3/minimaxh3.cpp):
@@ -144,9 +145,12 @@ model: served id, GET /v1/models lists them.
OUTPUTS: clip saved to the output folder under radiance/ AND returned OUTPUTS: clip saved to the output folder under radiance/ AND returned
as VIDEO (preview/chain) + file path + server job id. Progress bar as VIDEO (preview/chain) + file path + server job id. Progress bar
tracks the job; `timeout` bounds the wait. The node prints a tracks the job; `timeout` bounds the wait. The node prints a
PROGRESS LINE to the ComfyUI console every poll (~3s): PROGRESS LINE to the ComfyUI console WHENEVER A STEP COMPLETES
(it polls the job every 3s but prints only on a new step, phase
change, or every 30s as a keep-alive -- mirroring the server's
per-step log):
"job_x: 45%, step 12/26, 5.2 s/step, eta ~1m 07s (+decode), "job_x: 45%, step 12/26, 5.2 s/step, eta ~1m 07s (+decode),
elapsed 55s" -- the s/step is MEASURED from the step counter elapsed 55s" -- the s/step is MEASURED over >=2-step windows
(smoothed, so it tracks a latent-upscale's draft->refine pace (smoothed, so it tracks a latent-upscale's draft->refine pace
change), and the eta is remaining-steps x that pace. Real step change), and the eta is remaining-steps x that pace. Real step
counts come from a server built after Oct 2026; older servers counts come from a server built after Oct 2026; older servers
@@ -432,11 +436,11 @@ class RadianceMiniMax(io.ComfyNode):
"The clip is **saved to the output folder** under `radiance/` AND returned as " "The clip is **saved to the output folder** under `radiance/` AND returned as "
"a `VIDEO` (preview/chain), plus the saved `file` path and server `job id`. " "a `VIDEO` (preview/chain), plus the saved `file` path and server `job id`. "
"The node polls the job, drives its progress bar, and prints a live line to " "The node polls the job, drives its progress bar, and prints a live line to "
"the ComfyUI console every ~3 s (`45%, step 12/26, 5.2 s/step, eta ~1m 07s " "the ComfyUI console **per completed step** (keep-alive every 30 s) — "
"(+decode)` — the pace is measured from the step counter and the eta is " "`45%, step 12/26, 5.2 s/step, eta ~1m 07s (+decode)`, the pace measured "
"remaining steps × that pace; real steps on a server built after Oct 2026, " "from the step counter and the eta = remaining steps × that pace; real "
"`~step` derived from progress otherwise); `timeout` (advanced) bounds the " "steps on a server built after Oct 2026, `~step` derived from progress "
"wait."), "otherwise); `timeout` (advanced) bounds the wait."),
inputs=[ inputs=[
io.String.Input("server_url", default="http://127.0.0.1:8133", io.String.Input("server_url", default="http://127.0.0.1:8133",
tooltip="the radiance server: http://<host>:8133 -- point it " tooltip="the radiance server: http://<host>:8133 -- point it "
@@ -720,9 +724,11 @@ class RadianceMiniMax(io.ComfyNode):
deadline = time.time() + timeout deadline = time.time() + timeout
t0 = time.time() t0 = time.time()
pace = _PaceTracker() pace = _PaceTracker()
logging.info(f"[{LOG}] job {job_id} submitted -- progress lines every " last_key, last_emit = None, 0.0
f"{POLL_SECONDS:.0f}s below; `docker logs -f` on the server shows them " logging.info(f"[{LOG}] job {job_id} submitted -- one line per completed step "
"per STEP too (a server built after Oct 2026)") "below (a slow phase or stall still speaks every "
f"{KEEPALIVE_SECONDS:.0f}s); `docker logs -f` on the server shows the "
"same pace per STEP (a server built after Oct 2026)")
while True: while True:
jr = s.get(f"{base}/v1/videos/{job_id}", timeout=30) jr = s.get(f"{base}/v1/videos/{job_id}", timeout=30)
jr.raise_for_status() jr.raise_for_status()
@@ -736,10 +742,18 @@ class RadianceMiniMax(io.ComfyNode):
p = j.get("progress") p = j.get("progress")
if isinstance(p, (int, float)) and bar is not None: if isinstance(p, (int, float)) and bar is not None:
bar.update_absolute(min(max(float(p), 0.0), 100.0)) bar.update_absolute(min(max(float(p), 0.0), 100.0))
# the heartbeat: ComfyUI's console gets a live line per poll, so a # the heartbeat: polling is the only way a plain HTTP client learns
# waiting user sees pace and eta instead of a silent spinner # anything (the server pushes nothing), but the CONSOLE LINE rides
# the step counter -- printed when a step completes (or the phase
# changes), keep-alive otherwise, so the log mirrors the server's
# own per-step line instead of repeating unchanged polls.
now = time.time() now = time.time()
logging.info(f"[{LOG}] {job_id}: {_progress_line(j, num_inference_steps, now - t0, pace.update(j, now))}") sps = pace.update(j, now)
done = j.get("steps_done")
key = (status, done if isinstance(done, int) else j.get("progress"))
if key != last_key or now - last_emit >= KEEPALIVE_SECONDS:
logging.info(f"[{LOG}] {job_id}: {_progress_line(j, num_inference_steps, now - t0, sps)}")
last_key, last_emit = key, now
if now > deadline: if now > deadline:
raise RuntimeError(f"job {job_id} still {status} after {timeout}s") raise RuntimeError(f"job {job_id} still {status} after {timeout}s")
time.sleep(POLL_SECONDS) time.sleep(POLL_SECONDS)