feat:统一节点进度事件
This commit is contained in:
@@ -10,6 +10,7 @@ from pydantic import ValidationError
|
||||
if TYPE_CHECKING:
|
||||
from app.config import Settings
|
||||
from app.exceptions import AppError, ImportProcessError
|
||||
from app.processor.progress import node_progress
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
@@ -37,7 +38,8 @@ class BaseNode(ABC):
|
||||
start_time = time.perf_counter()
|
||||
self.logger.info("节点开始")
|
||||
try:
|
||||
result = self.process(state)
|
||||
with node_progress(self.name, state):
|
||||
result = self.process(state)
|
||||
except GraphInterrupt:
|
||||
raise
|
||||
except (AppError, ValidationError):
|
||||
@@ -61,7 +63,8 @@ class BaseNode(ABC):
|
||||
start_time = time.perf_counter()
|
||||
self.logger.info("节点开始")
|
||||
try:
|
||||
result = await self.process(state)
|
||||
with node_progress(self.name, state):
|
||||
result = await self.process(state)
|
||||
except GraphInterrupt:
|
||||
raise
|
||||
except (AppError, ValidationError):
|
||||
|
||||
Reference in New Issue
Block a user