From 00af9fed352b4343faa31843bc937e5ada4e4141 Mon Sep 17 00:00:00 2001 From: yyhhyy <95077259+yyhhyyyyyy@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:15:07 +0800 Subject: [PATCH] fix(awel): Fix awel check for empty DataFrame data bug (#1430) --- dbgpt/core/awel/operators/base.py | 4 ++-- dbgpt/core/awel/task/base.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dbgpt/core/awel/operators/base.py b/dbgpt/core/awel/operators/base.py index f9ba12169..286979662 100644 --- a/dbgpt/core/awel/operators/base.py +++ b/dbgpt/core/awel/operators/base.py @@ -25,7 +25,7 @@ ) from ..dag.base import DAG, DAGContext, DAGNode, DAGVar -from ..task.base import EMPTY_DATA, OUT, T, TaskOutput +from ..task.base import EMPTY_DATA, OUT, T, TaskOutput, is_empty_data F = TypeVar("F", bound=FunctionType) @@ -213,7 +213,7 @@ async def call( Returns: OUT: The output of the node after execution. """ - if call_data != EMPTY_DATA: + if not is_empty_data(call_data): call_data = {"data": call_data} out_ctx = await self._runner.execute_workflow( self, call_data, exist_dag_ctx=dag_ctx diff --git a/dbgpt/core/awel/task/base.py b/dbgpt/core/awel/task/base.py index a5cbc6e0b..abadfcaf0 100644 --- a/dbgpt/core/awel/task/base.py +++ b/dbgpt/core/awel/task/base.py @@ -56,6 +56,8 @@ def is_empty_data(data: Any): """Check if the data is empty.""" if isinstance(data, _EMPTY_DATA_TYPE): return data in (EMPTY_DATA, SKIP_DATA) + elif hasattr(data, "empty"): + return getattr(data, "empty", False) return False