mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-09 22:00:49 +08:00
backends and other changes - remove uv.lock since it will not be used in most cases for installation - add cli args to prevent some custom nodes from installing packages at runtime - temp directories can now be shared between workers without being deleted - propcache yanked is now in the dependencies - fix configuration arguments loading in some tests
27 lines
894 B
Python
27 lines
894 B
Python
# todo: this should be defined in a common place, the fact that the nodes are imported by execution the way that they are is pretty radioactive
|
|
import threading
|
|
|
|
import lazy_object_proxy
|
|
|
|
from .execution_context import current_execution_context
|
|
from .nodes.package import import_all_nodes_in_workspace
|
|
from .nodes.package_typing import ExportedNodes, exported_nodes_view
|
|
|
|
_nodes_local = threading.local()
|
|
|
|
|
|
def invalidate():
|
|
_nodes_local.nodes = lazy_object_proxy.Proxy(import_all_nodes_in_workspace)
|
|
|
|
|
|
def get_nodes() -> ExportedNodes:
|
|
current_ctx = current_execution_context()
|
|
try:
|
|
nodes = _nodes_local.nodes
|
|
except (LookupError, AttributeError):
|
|
nodes = _nodes_local.nodes = lazy_object_proxy.Proxy(import_all_nodes_in_workspace)
|
|
|
|
if len(current_ctx.custom_nodes) == 0:
|
|
return nodes
|
|
return exported_nodes_view(nodes, current_ctx.custom_nodes)
|