mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-10 13:32:36 +08:00
sort execution order by PRIORITY
This commit is contained in:
parent
a57b0c797b
commit
9b5d35c74d
@ -367,6 +367,11 @@ class PromptExecutor:
|
||||
while len(to_execute) > 0:
|
||||
#always execute the output that depends on the least amount of unexecuted nodes first
|
||||
to_execute = sorted(list(map(lambda a: (len(recursive_will_execute(prompt, self.outputs, a[-1])), a[-1]), to_execute)))
|
||||
#except that we execute nodes with higher PRIOIRTY first
|
||||
def priority(prompt, item):
|
||||
class_ = nodes.NODE_CLASS_MAPPINGS[prompt[item]['class_type']]
|
||||
return class_.PRIORITY if hasattr(class_, 'PRIORITY') else 0
|
||||
to_execute = sorted( to_execute, key = lambda a : priority(prompt, a[-1]), reverse=True )
|
||||
output_node_id = to_execute.pop(0)[-1]
|
||||
|
||||
# This call shouldn't raise anything if there's an error deep in
|
||||
|
||||
Loading…
Reference in New Issue
Block a user