Nodes/ComfyUI-Just-Nodes/Batch Stepper πŸ’Ž Just Nodes
ComfyUI Node

Batch Stepper πŸ’Ž Just Nodes

Run a batch, then step β€” the loop node for hands-off prompt rotation

By Arroz-11Β·Created 7 months agoΒ·Updated 4 days agoΒ· 1
Batch Stepper πŸ’Ž Just Nodes
    • select
    β—„total_runs10β–Ί
    β—„step0β–Ί
    β—„step_limit5β–Ί
    β—„modetrueβ–Ί

    Batch Stepper is the node that automates "run this N times, then move on." It outputs a single INT called select that stays at one value for a run of total_runs queue executions, then increments, all the way up to step_limit, then wraps back to zero. Wire that integer into a Picker's select, a Labeled Index, an Image From Folder's index, or any other index input, and you've got a hands-off rotation loop that ComfyUI's built-in control_after_generate can't express in one shot.

    The clever part is that it's front-end driven. The heavy lifting lives in the pack's JavaScript: a display-only run counter (never sent to the backend) counts how many times you've queued, and when the graph finishes, the script bumps run, re-queues, and only when run hits total_runs - 1 does it step the actual step value that the backend outputs. Because the backend node itself is a pure passthrough - it returns step and nothing else - ComfyUI's downstream cache stays intact, so your sampler and VAE decode results aren't recomputed between runs unless their inputs actually changed. That's the real reason this exists: a JS-side counter that doesn't dirty the cache, versus the usual hack of re-queuing everything.

    The inputs that matter:

    • total_runs - how many queue executions happen at each step value before it increments (default 10).
    • step - the current value being output; it's an input so you can inspect and override it.
    • step_limit - how many distinct steps to cycle through before wrapping to 0 (default 5).
    • mode - a Run/Stop boolean. Flip it off and the loop stops auto-advancing.

    So with total_runs=3, step_limit=4, the output goes 0,0,0, 1,1,1, 2,2,2, 3,3,3, then back to 0. Pair that with a Picker x4 and you've rotated through four prompts, three runs each, and walked away from the keyboard.

    Installing it

    Same as every Just Nodes node: ComfyUI Manager β†’ search "Just Nodes" β†’ install β†’ restart, or cd ComfyUI/custom_nodes && git clone https://github.com/Arroz-11/ComfyUI-Just-Nodes.git. No models, no extra dependencies, MIT licensed.

    Gotchas

    • It re-queues by itself. The JS watches for a finished run and fires a new queue prompt. If you didn't expect it to keep going, it will.
    • step starts at 0 and the loop only advances it after the full run count - the first total_runs executions all output 0.
    • It's a JS-driven node, which means it depends on the front-end extension loading. ComfyUI's Nodes 2.0 canvas rewrite has a history of breaking front-end-driven custom nodes (rgthree's broke the same way), so if the node ever stops auto-stepping after a ComfyUI update, that's the first thing to suspect.
    CategoryπŸ’Ž Just Nodes

    Inputs (4)

    NameTypeDefaultDescription
    total_runsINT101–18446744073709550000β€”
    stepINT00–18446744073709550000β€”
    step_limitINT51–18446744073709550000β€”
    modeBOOLEANtrueβ€”

    Outputs (1)

    NameTypeDescription
    selectINTβ€”