mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-17 01:52:59 +08:00
execution: Allow a subgraph nodes to execute multiple times (#10499)
In the case of --cache-none lazy and subgraph execution can cause anything to be run multiple times per workflow. If that rerun nodes is in itself a subgraph generator, this will crash for two reasons. pending_subgraph_results[] does not cleanup entries after their use. So when a pending_subgraph_result is consumed, remove it from the list so that if the corresponding node is fully re-executed this misses lookup and it fall through to execute the node as it should. Secondly, theres is an explicit enforcement against dups in the addition of subgraphs nodes as ephemerals to the dymprompt. Remove this enforcement as the use case is now valid.
This commit is contained in:
parent
8817f8fc14
commit
d202c2ba74
@ -445,6 +445,7 @@ async def execute(server, dynprompt, caches, current_item, extra_data, executed,
|
|||||||
resolved_outputs.append(tuple(resolved_output))
|
resolved_outputs.append(tuple(resolved_output))
|
||||||
output_data = merge_result_data(resolved_outputs, class_def)
|
output_data = merge_result_data(resolved_outputs, class_def)
|
||||||
output_ui = []
|
output_ui = []
|
||||||
|
del pending_subgraph_results[unique_id]
|
||||||
has_subgraph = False
|
has_subgraph = False
|
||||||
else:
|
else:
|
||||||
get_progress_state().start_progress(unique_id)
|
get_progress_state().start_progress(unique_id)
|
||||||
@ -527,10 +528,6 @@ async def execute(server, dynprompt, caches, current_item, extra_data, executed,
|
|||||||
if new_graph is None:
|
if new_graph is None:
|
||||||
cached_outputs.append((False, node_outputs))
|
cached_outputs.append((False, node_outputs))
|
||||||
else:
|
else:
|
||||||
# Check for conflicts
|
|
||||||
for node_id in new_graph.keys():
|
|
||||||
if dynprompt.has_node(node_id):
|
|
||||||
raise DuplicateNodeError(f"Attempt to add duplicate node {node_id}. Ensure node ids are unique and deterministic or use graph_utils.GraphBuilder.")
|
|
||||||
for node_id, node_info in new_graph.items():
|
for node_id, node_info in new_graph.items():
|
||||||
new_node_ids.append(node_id)
|
new_node_ids.append(node_id)
|
||||||
display_id = node_info.get("override_display_id", unique_id)
|
display_id = node_info.get("override_display_id", unique_id)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user