mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-22 20:30:25 +08:00
Improve the way the execution context is initialized
This commit is contained in:
parent
479e20d233
commit
726804ca63
@ -12,10 +12,6 @@ from .distributed.server_stub import ServerStub
|
|||||||
from .nodes.package_typing import ExportedNodes, exported_nodes_view
|
from .nodes.package_typing import ExportedNodes, exported_nodes_view
|
||||||
from .progress_types import AbstractProgressRegistry, ProgressRegistryStub
|
from .progress_types import AbstractProgressRegistry, ProgressRegistryStub
|
||||||
|
|
||||||
comfyui_execution_context: Final[ContextVar] = ContextVar("comfyui_execution_context")
|
|
||||||
# enables context var propagation across process boundaries for process pool executors
|
|
||||||
cvpickle.register_contextvar(comfyui_execution_context, __name__)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class ExecutionContext:
|
class ExecutionContext:
|
||||||
@ -38,7 +34,9 @@ class ExecutionContext:
|
|||||||
yield self.list_index
|
yield self.list_index
|
||||||
|
|
||||||
|
|
||||||
comfyui_execution_context.set(ExecutionContext(server=ServerStub(), folder_names_and_paths=FolderNames(is_root=True), custom_nodes=ExportedNodes(), progress_registry=ProgressRegistryStub()))
|
comfyui_execution_context: Final[ContextVar] = ContextVar("comfyui_execution_context", default=ExecutionContext(server=ServerStub(), folder_names_and_paths=FolderNames(is_root=True), custom_nodes=ExportedNodes(), progress_registry=ProgressRegistryStub()))
|
||||||
|
# enables context var propagation across process boundaries for process pool executors
|
||||||
|
cvpickle.register_contextvar(comfyui_execution_context, __name__)
|
||||||
|
|
||||||
|
|
||||||
def current_execution_context() -> ExecutionContext:
|
def current_execution_context() -> ExecutionContext:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user