ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

[Feature Request] Allow a custom node to only be executed when IS_CHANGED

Open fcolecumberri opened this issue 1 year ago • 6 comments

I am trying to create a custom node that may not be ready to be executed since its execution depends on other node to finish, so I am trying to make it skip its execution until the IS_CHANGED mechanism is ready.

I have tried to sleep the node until the result is there, however by doing that I disallowed the other node to get executed.

Another way I could solve this is if there could be way to tell the system to just put a node at the end/beginning of the execution queue so I could prioritize the node execution as needed.

fcolecumberri avatar Mar 21 '24 20:03 fcolecumberri

The rgthree extension adds "Queue Selected Output Nodes" in right-click menu to comfyui, which is amazing. (it doesn't update seed set to increment I think but otherwise it's great).

Might help you, if I understand your issue.

dotJack avatar Mar 22 '24 10:03 dotJack

Why not have an input (dummy or otherwise) from that node to yours?

NutchapolSal avatar Mar 22 '24 14:03 NutchapolSal

Why not have an input (dummy or otherwise) from that node to yours?

I thought about it (and maybe that's what I'm going to do), however if the objective of ComfyUI is to give as much control as possible to the dev/artist, then the idea of a node saying (I should go last/I should go first/my priority is N) without making a spaghetti of dummy connections could open possibilities not just for my case but for other dev's ideas.

fcolecumberri avatar Mar 22 '24 15:03 fcolecumberri

IMO order of execution of nodes should be an implementation detail, not something the artist has control of (because it wouldn't matter anyways if the same input data always produce the same output data). If you really think about it, the node graph is basically already a priority system of sorts. Although having priority only on the output nodes may be useful but I don't think it fits in this issue.

Are you making nodes with state (or even global state)? You should send and receive values through the graph instead.

NutchapolSal avatar Mar 23 '24 20:03 NutchapolSal

Actually having a priority on the output nodes would fit the issue.

fcolecumberri avatar Mar 24 '24 13:03 fcolecumberri

@fcolecumberri ComfyUI already does that:

https://docs.comfy.org/essentials/custom_node_server_overview#is-changed

Nodes are only executed when the inputs change (or IS_CHANGED returns a value different from the previous run). As for giving explicit control that is not ideal because it prevents Comfy from figuring out the most efficient way to execute all the nodes in the graph.

robinjhuang avatar Aug 20 '24 20:08 robinjhuang

@fcolecumberri ComfyUI already does that:

https://docs.comfy.org/essentials/custom_node_server_overview#is-changed

Nodes are only executed when the inputs change (or IS_CHANGED returns a value different from the previous run). As for giving explicit control that is not ideal because it prevents Comfy from figuring out the most efficient way to execute all the nodes in the graph.

It doesn't matter at this point, I have found an alternative, however, that's not what I was referring, The thing I wanted is to not execute until a specific node run (A node that it's not connected).

fcolecumberri avatar Aug 21 '24 21:08 fcolecumberri