From 836ed1f380ed67e51705d207324f0b6d3a589c26 Mon Sep 17 00:00:00 2001 From: -LAN- Date: Wed, 10 Sep 2025 02:35:05 +0800 Subject: [PATCH] refactor(graph_engine): Move ErrorHandler into a single file package Signed-off-by: -LAN- --- api/.importlinter | 2 +- .../{error_handling => }/error_handler.py | 2 +- .../workflow/graph_engine/error_handling/__init__.py | 12 ------------ .../graph_engine/event_management/event_handlers.py | 2 +- api/core/workflow/graph_engine/graph_engine.py | 2 +- 5 files changed, 4 insertions(+), 16 deletions(-) rename api/core/workflow/graph_engine/{error_handling => }/error_handler.py (99%) delete mode 100644 api/core/workflow/graph_engine/error_handling/__init__.py diff --git a/api/.importlinter b/api/.importlinter index 9a593c288a..98fe5f50bb 100644 --- a/api/.importlinter +++ b/api/.importlinter @@ -58,7 +58,7 @@ layers = orchestration command_processing event_management - error_handling + error_handler graph_traversal graph_state_manager worker_management diff --git a/api/core/workflow/graph_engine/error_handling/error_handler.py b/api/core/workflow/graph_engine/error_handler.py similarity index 99% rename from api/core/workflow/graph_engine/error_handling/error_handler.py rename to api/core/workflow/graph_engine/error_handler.py index aa6e6287e0..62e144c12a 100644 --- a/api/core/workflow/graph_engine/error_handling/error_handler.py +++ b/api/core/workflow/graph_engine/error_handler.py @@ -23,7 +23,7 @@ from core.workflow.graph_events import ( from core.workflow.node_events import NodeRunResult if TYPE_CHECKING: - from ..domain import GraphExecution + from .domain import GraphExecution logger = logging.getLogger(__name__) diff --git a/api/core/workflow/graph_engine/error_handling/__init__.py b/api/core/workflow/graph_engine/error_handling/__init__.py deleted file mode 100644 index 3189fea0c9..0000000000 --- a/api/core/workflow/graph_engine/error_handling/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -""" -Error handling for graph engine. - -This package provides error handling functionality for managing -node execution failures with different recovery strategies. -""" - -from .error_handler import ErrorHandler - -__all__ = [ - "ErrorHandler", -] diff --git a/api/core/workflow/graph_engine/event_management/event_handlers.py b/api/core/workflow/graph_engine/event_management/event_handlers.py index 10e7d421af..63929381de 100644 --- a/api/core/workflow/graph_engine/event_management/event_handlers.py +++ b/api/core/workflow/graph_engine/event_management/event_handlers.py @@ -31,7 +31,7 @@ from ..domain.graph_execution import GraphExecution from ..response_coordinator import ResponseStreamCoordinator if TYPE_CHECKING: - from ..error_handling import ErrorHandler + from ..error_handler import ErrorHandler from ..graph_state_manager import GraphStateManager from ..graph_traversal import EdgeProcessor from .event_manager import EventManager diff --git a/api/core/workflow/graph_engine/graph_engine.py b/api/core/workflow/graph_engine/graph_engine.py index 019a1aaade..ff56605d3d 100644 --- a/api/core/workflow/graph_engine/graph_engine.py +++ b/api/core/workflow/graph_engine/graph_engine.py @@ -31,7 +31,7 @@ from models.enums import UserFrom from .command_processing import AbortCommandHandler, CommandProcessor from .domain import ExecutionContext, GraphExecution from .entities.commands import AbortCommand -from .error_handling import ErrorHandler +from .error_handler import ErrorHandler from .event_management import EventHandler, EventManager from .graph_state_manager import GraphStateManager from .graph_traversal import EdgeProcessor, SkipPropagator