Commit Graph

9 Commits

Author SHA1 Message Date
doctorpangloss
87ab9d42d0 Merge branch 'execution_model_inversion' of github.com:guill/ComfyUI into pr-execution 2024-07-19 17:49:41 -07:00
Jacob Segal
06f3ce9200 Raise exception for bad get_node calls. 2024-04-21 16:10:01 -07:00
Jacob Segal
ecbef304ed Remove superfluous function parameter 2024-04-20 23:07:18 -07:00
Jacob Segal
7dbee88485 Add docs on when ExecutionBlocker should be used 2024-04-20 22:54:38 -07:00
Jacob Segal
dd3bafb40b Display an error for dependency cycles
Previously, dependency cycles that were created during node expansion
would cause the application to quit (due to an uncaught exception). Now,
we'll throw a proper error to the UI. We also make an attempt to 'blame'
the most relevant node in the UI.
2024-04-20 22:40:38 -07:00
Jacob Segal
5dc13651b0 Use custom exception types. 2024-04-20 18:12:42 -07:00
Jacob Segal
a0bf532558 Use fstrings instead of '%' formatting syntax 2024-04-20 17:52:23 -07:00
Jacob Segal
e4e20d79b2 Allow input_info to be of type None 2024-02-14 21:04:50 -08:00
Jacob Segal
36b2214e30 Execution Model Inversion
This PR inverts the execution model -- from recursively calling nodes to
using a topological sort of the nodes. This change allows for
modification of the node graph during execution. This allows for two
major advantages:

    1. The implementation of lazy evaluation in nodes. For example, if a
    "Mix Images" node has a mix factor of exactly 0.0, the second image
    input doesn't even need to be evaluated (and visa-versa if the mix
    factor is 1.0).

    2. Dynamic expansion of nodes. This allows for the creation of dynamic
    "node groups". Specifically, custom nodes can return subgraphs that
    replace the original node in the graph. This is an incredibly
    powerful concept. Using this functionality, it was easy to
    implement:
        a. Components (a.k.a. node groups)
        b. Flow control (i.e. while loops) via tail recursion
        c. All-in-one nodes that replicate the WebUI functionality
        d. and more
    All of those were able to be implemented entirely via custom nodes,
    so those features are *not* a part of this PR. (There are some
    front-end changes that should occur before that functionality is
    made widely available, particularly around variant sockets.)

The custom nodes associated with this PR can be found at:
https://github.com/BadCafeCode/execution-inversion-demo-comfyui

Note that some of them require that variant socket types ("*") be
enabled.
2024-01-28 20:48:42 -08:00