Nodes/ComfyUI-LegionPower/Legion: Join Campaign
ComfyUI Node

Legion: Join Campaign

Picking up async results when your worker runs in the background

By Transhumai·Created 10 months ago·Updated 9 months ago· 1
Legion: Join Campaign
  • legion_campaign
  • output_1
  • output_2
  • output_3
  • output_4
  • output_5

LegionJoin is what you reach for when a Legion Master ran in async mode. With execution.asynch: true in your config, the Master returns the instant the worker job is submitted - you get a legion_campaign handle, not results. This node takes that handle, waits for the worker to finish, and hands you the outputs.

It's the same idea as joining a thread in programming: block here until the background work completes, then pick up the return value.

How it works

The Master's campaign object carries the config, the resolved worker port, and - in async mode - a Python thread that's polling the worker's HTTP API for completion. LegionJoin calls join() on that thread to block until the worker reports done, checks the campaign status (raising if it FAILED), then reads the output manifest the worker's LegionExporter wrote and deserializes output_1output_5 for you.

Nice detail: it also works with sync-mode campaigns. In sync mode the Master already stored the outputs on the campaign object, so the Join just returns those without re-reading the manifest. Either way, it's a safe place to hang results.

Inputs and outputs

  • legion_campaign (required, type LEGION_CAMPAIGN) - from any Master's legion_campaign output.
  • output_1output_5 - the results. Note the worker's Exporter only has five input slots, so even a 12-channel Master funnels through five returned values here.

Why async at all?

So your main graph isn't wedged for the duration of a long worker job. On a multi-GPU box you can fire off several Masters, keep working, then Join when you actually need the results. That's also where Legion: Join All comes in - it's a barrier that waits on up to four campaigns at once (though it returns handles, not outputs).

Installing

ComfyUI Manager: search "LegionPower". Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/Transhumai/ComfyUI-LegionPower.git
cd ComfyUI-LegionPower
pip install -r requirements.txt

Restart. The dependency list is just requests; nothing to download.

Troubleshooting

  • Outputs are the literal string ERROR: async is True!... - that's the Master's hint that you're in async mode and must collect via Join. You've wired the Master's outputs directly instead of through this node.
  • Campaign failed during execution - the worker workflow errored; check the worker's console/port for the traceback.
  • Output manifest not found - the worker ran without a connected Exporter. Same root cause as on the Master side.

Just remember: async mode and this node are a package deal. Skip Join and you're holding a receipt instead of an image.

CategoryLegion

Inputs (1)

NameTypeDefaultDescription
legion_campaignLEGION_CAMPAIGN

Outputs (5)

NameTypeDescription
output_1*
output_2*
output_3*
output_4*
output_5*