diff --git a/comfy/component_model/executor_types.py b/comfy/component_model/executor_types.py index e5fb8e59c..1b3d5de4c 100644 --- a/comfy/component_model/executor_types.py +++ b/comfy/component_model/executor_types.py @@ -130,7 +130,7 @@ class ExecutorToClientProgress(Protocol): last_prompt_id: Optional[str] @property - def receive_all_progress_notifications(self): + def receive_all_progress_notifications(self) -> bool: """ Set to true if this should receive progress bar updates, in addition to the standard execution lifecycle messages :return: diff --git a/comfy/distributed/server_stub.py b/comfy/distributed/server_stub.py index 912cf65d9..b1d63c2ac 100644 --- a/comfy/distributed/server_stub.py +++ b/comfy/distributed/server_stub.py @@ -1,7 +1,7 @@ from __future__ import annotations import uuid -from typing import Literal, Optional +from typing import Literal, Optional, Union from ..component_model.executor_types import ExecutorToClientProgress, StatusMessage, ExecutingMessage from ..component_model.queue_types import BinaryEventTypes @@ -25,7 +25,7 @@ class ServerStub(ExecutorToClientProgress): def queue_updated(self, queue_remaining: Optional[int] = None): pass - def send_progress_text(self, text: str, node_id: str = None): + def send_progress_text(self, text: Union[bytes, bytearray, str], node_id: str, sid=None): pass @property diff --git a/comfy/nodes/vanilla_node_importing.py b/comfy/nodes/vanilla_node_importing.py index 522c09ede..cadf437c2 100644 --- a/comfy/nodes/vanilla_node_importing.py +++ b/comfy/nodes/vanilla_node_importing.py @@ -1,11 +1,11 @@ from __future__ import annotations +import fnmatch import importlib import importlib.util import logging import os import sys -import fnmatch import time import types from contextlib import contextmanager @@ -18,6 +18,7 @@ from .comfyui_v3_package_imports import _comfy_entrypoint_upstream_v3_imports from .package_typing import ExportedNodes from ..cmd import folder_paths from ..component_model.plugins import prompt_server_instance_routes +from ..distributed.server_stub import ServerStub logger = logging.getLogger(__name__) @@ -43,8 +44,9 @@ class StreamToLogger: pass -class _PromptServerStub: +class _PromptServerStub(ServerStub): def __init__(self): + super().__init__() self.routes = prompt_server_instance_routes self.on_prompt_handlers = [] @@ -52,6 +54,9 @@ class _PromptServerStub: # todo: these need to be added to a real prompt server if the loading order is behaving in a complex way self.on_prompt_handlers.append(handler) + def send_sync(self, *args, **kwargs): + logger.warning(f"Node tried to send a message over the websocket while importing, args={args} kwargs={kwargs}") + def _vanilla_load_importing_execute_prestartup_script(node_paths: Iterable[str]) -> None: def execute_script(script_path):