EnumerateJob
Stamp a running index onto every step of a job
- job
- job
- count
If you're numbering output files, or you just want a clean "step N of total" value to feed into a ProgressBar or a filename, you don't need to hand-build a separate Range sequence and zip it into your job. EnumerateJob does that in one step: give it a job you already have, and it adds a running index as a new attribute on every single step.
How it works
Under the hood it's a straightforward enumerate() over the job - for step 0, 1, 2, … it merges a new {name: index} entry into that step's existing attribute dictionary. It doesn't build a job from scratch; it takes one you already assembled (via MakeJob, CombineJobs, or another EnumerateJob) and layers one more attribute on top, leaving everything already in there untouched.
The inputs and outputs that matter
job(JOB) - the job to enumerate. This has to already be a JOB, not a bare sequence - build it with MakeJob first if you're starting from scratch.name(STRING) - what to call the new index attribute, e.g.stepori.
Outputs are job (JOB, same length, one more key per step) and count (INT, the total number of steps) - pipe job on into JobToList or another CombineJobs, and count wherever you need the total, like a ProgressBar denominator.
That last pairing is the practical reason this node exists: wire the index attribute through GetAttributeInt, divide it by count with a simple math node, and you've got the exact fraction ProgressBar's progress input wants - a live "step 4 of 12" bar rendered right into your output, built from two nodes instead of hand-building a parallel Range sequence and zipping it in yourself.
How to install it
Via ComfyUI Manager: search comfyui-job-iterator, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ali1234/comfyui-job-iterator
then restart. No dependencies.
Common issues & troubleshooting
Your index attribute silently disappeared, or overwrote something else. The merge is a plain dictionary update, so if the job already had an attribute using the exact name you picked for the index, EnumerateJob's value wins and the original is gone - no warning either way. Pick an index name you're not already using elsewhere, like i or step_num.
You expected count to change something upstream. It doesn't - count is purely informational output, a read-out of how many steps are in the job you just enumerated. It doesn't feed back to affect the job itself.
Numbering starts at 0, not 1. Since it's a direct enumerate(), the first step gets index 0. If you want human-friendly filenames starting at 1, add 1 downstream (a simple math node, or bake it into a FormatAttributes template) rather than expecting this node to offset it for you.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| job | JOB | — | |
| name | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| job | JOB | — |
| count | INT | — |