From f40e00cb357754ae99a2eac59d8fbfae2f23607a Mon Sep 17 00:00:00 2001 From: strint Date: Thu, 16 Oct 2025 19:38:13 +0800 Subject: [PATCH] add detail debug --- execution.py | 26 ++++++++++++++++++++++++++ server.py | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/execution.py b/execution.py index 1dc35738b..69bd53502 100644 --- a/execution.py +++ b/execution.py @@ -400,7 +400,12 @@ async def execute(server, dynprompt, caches, current_item, extra_data, executed, inputs = dynprompt.get_node(unique_id)['inputs'] class_type = dynprompt.get_node(unique_id)['class_type'] class_def = nodes.NODE_CLASS_MAPPINGS[class_type] + + # Log node execution start + logging.info(f"๐Ÿ“ Node [{display_node_id}] START: {class_type}") + if caches.outputs.get(unique_id) is not None: + logging.info(f"โœ… Node [{display_node_id}] CACHED: {class_type} (using cached output)") if server.client_id is not None: cached_output = caches.ui.get(unique_id) or {} server.send_sync("executed", { "node": unique_id, "display_node": display_node_id, "output": cached_output.get("output",None), "prompt_id": prompt_id }, server.client_id) @@ -446,15 +451,20 @@ async def execute(server, dynprompt, caches, current_item, extra_data, executed, has_subgraph = False else: get_progress_state().start_progress(unique_id) + logging.info(f"๐Ÿ” Node [{display_node_id}] Getting input data for {class_type}") input_data_all, missing_keys, hidden_inputs = get_input_data(inputs, class_def, unique_id, caches.outputs, dynprompt, extra_data) + logging.info(f"๐Ÿ“ฅ Node [{display_node_id}] Input data ready, keys: {list(input_data_all.keys())}") if server.client_id is not None: server.last_node_id = display_node_id server.send_sync("executing", { "node": unique_id, "display_node": display_node_id, "prompt_id": prompt_id }, server.client_id) obj = caches.objects.get(unique_id) if obj is None: + logging.info(f"๐Ÿ—๏ธ Node [{display_node_id}] Creating new instance of {class_type}") obj = class_def() caches.objects.set(unique_id, obj) + else: + logging.info(f"โ™ป๏ธ Node [{display_node_id}] Reusing cached instance of {class_type}") if issubclass(class_def, _ComfyNodeInternal): lazy_status_present = first_real_override(class_def, "check_lazy_status") is not None @@ -493,7 +503,9 @@ async def execute(server, dynprompt, caches, current_item, extra_data, executed, def pre_execute_cb(call_index): # TODO - How to handle this with async functions without contextvars (which requires Python 3.12)? GraphBuilder.set_default_prefix(unique_id, call_index, 0) + logging.info(f"โš™๏ธ Node [{display_node_id}] Executing {class_type}") output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs) + logging.info(f"๐Ÿ“ค Node [{display_node_id}] Execution completed, has_subgraph: {has_subgraph}, has_pending: {has_pending_tasks}") if has_pending_tasks: pending_async_nodes[unique_id] = output_data unblock = execution_list.add_external_block(unique_id) @@ -572,6 +584,7 @@ async def execute(server, dynprompt, caches, current_item, extra_data, executed, for name, inputs in input_data_all.items(): input_data_formatted[name] = [format_value(x) for x in inputs] + logging.error(f"โŒ Node [{display_node_id}] FAILED: {class_type}") logging.error(f"!!! Exception during processing !!! {ex}") logging.error(traceback.format_exc()) tips = "" @@ -593,6 +606,8 @@ async def execute(server, dynprompt, caches, current_item, extra_data, executed, get_progress_state().finish_progress(unique_id) executed.add(unique_id) + + logging.info(f"โœ… Node [{display_node_id}] SUCCESS: {class_type} completed") return (ExecutionResult.SUCCESS, None, None) @@ -649,6 +664,7 @@ class PromptExecutor: asyncio.run(self.execute_async(prompt, prompt_id, extra_data, execute_outputs)) async def execute_async(self, prompt, prompt_id, extra_data={}, execute_outputs=[]): + logging.info(f"๐Ÿš€ Workflow execution START: prompt_id={prompt_id}, nodes_count={len(prompt)}") nodes.interrupt_processing(False) if "client_id" in extra_data: @@ -672,6 +688,9 @@ class PromptExecutor: for node_id in prompt: if self.caches.outputs.get(node_id) is not None: cached_nodes.append(node_id) + + if len(cached_nodes) > 0: + logging.info(f"๐Ÿ’พ Workflow has {len(cached_nodes)} cached nodes: {cached_nodes}") comfy.model_management.cleanup_models_gc() self.add_message("execution_cached", @@ -684,6 +703,8 @@ class PromptExecutor: current_outputs = self.caches.outputs.all_node_ids() for node_id in list(execute_outputs): execution_list.add_node(node_id) + + logging.info(f"๐Ÿ“‹ Workflow execution list prepared, executing {len(execute_outputs)} output nodes") while not execution_list.is_empty(): node_id, error, ex = await execution_list.stage_node_execution() @@ -695,6 +716,7 @@ class PromptExecutor: result, error, ex = await execute(self.server, dynamic_prompt, self.caches, node_id, extra_data, executed, prompt_id, execution_list, pending_subgraph_results, pending_async_nodes) self.success = result != ExecutionResult.FAILURE if result == ExecutionResult.FAILURE: + logging.error(f"๐Ÿ’ฅ Workflow execution FAILED at node {node_id}") self.handle_execution_error(prompt_id, dynamic_prompt.original_prompt, current_outputs, executed, error, ex) break elif result == ExecutionResult.PENDING: @@ -703,6 +725,7 @@ class PromptExecutor: execution_list.complete_node_execution() else: # Only execute when the while-loop ends without break + logging.info(f"๐ŸŽ‰ Workflow execution SUCCESS: prompt_id={prompt_id}, executed_nodes={len(executed)}") self.add_message("execution_success", { "prompt_id": prompt_id }, broadcast=False) ui_outputs = {} @@ -719,7 +742,10 @@ class PromptExecutor: } self.server.last_node_id = None if comfy.model_management.DISABLE_SMART_MEMORY: + logging.info("๐Ÿงน Unloading all models (DISABLE_SMART_MEMORY is enabled)") comfy.model_management.unload_all_models() + + logging.info(f"โœจ Workflow execution COMPLETED: prompt_id={prompt_id}") async def validate_inputs(prompt_id, prompt, item, validated): diff --git a/server.py b/server.py index 80e9d3fa7..515307bf6 100644 --- a/server.py +++ b/server.py @@ -673,7 +673,7 @@ class PromptServer(): @routes.post("/prompt") async def post_prompt(request): - logging.info("got prompt") + logging.info("got prompt in debug comfyui") json_data = await request.json() json_data = self.trigger_on_prompt(json_data)