diff --git a/api/core/workflow/nodes/event/event.py b/api/core/workflow/nodes/event/event.py index 65147bc40686a6..137b47655102af 100644 --- a/api/core/workflow/nodes/event/event.py +++ b/api/core/workflow/nodes/event/event.py @@ -39,15 +39,9 @@ class RunRetryEvent(BaseModel): start_at: datetime = Field(..., description="Retry start time") -class SingleStepRetryEvent(BaseModel): +class SingleStepRetryEvent(NodeRunResult): """Single step retry event""" status: str = WorkflowNodeExecutionStatus.RETRY.value - inputs: dict | None = Field(..., description="input") - error: str = Field(..., description="error") - outputs: dict | None = Field(..., description="output") - retry_index: int = Field(..., description="Retry attempt number") - error: str = Field(..., description="error") elapsed_time: float = Field(..., description="elapsed time") - execution_metadata: dict | None = Field(..., description="execution metadata") diff --git a/api/fields/workflow_run_fields.py b/api/fields/workflow_run_fields.py index 99c8dc100479fc..caca88a9b7ffb0 100644 --- a/api/fields/workflow_run_fields.py +++ b/api/fields/workflow_run_fields.py @@ -82,13 +82,15 @@ } retry_event_field = { - "error": fields.String, - "retry_index": fields.Integer, - "inputs": fields.Raw(attribute="inputs"), "elapsed_time": fields.Float, - "execution_metadata": fields.Raw(attribute="execution_metadata_dict"), "status": fields.String, + "inputs": fields.Raw(attribute="inputs"), + "process_data": fields.Raw(attribute="process_data"), "outputs": fields.Raw(attribute="outputs"), + "metadata": fields.Raw(attribute="metadata"), + "llm_usage": fields.Raw(attribute="llm_usage"), + "error": fields.String, + "retry_index": fields.Integer, } diff --git a/api/services/workflow_service.py b/api/services/workflow_service.py index ead552d6c2e83e..baa69b3d8dc8d7 100644 --- a/api/services/workflow_service.py +++ b/api/services/workflow_service.py @@ -268,18 +268,14 @@ def run_draft_workflow_node( node_run_result.retry_index = retries retry_events.append( SingleStepRetryEvent( - inputs=WorkflowEntry.handle_special_values(node_run_result.inputs) - if node_run_result.inputs - else None, + elapsed_time=time.perf_counter() - retry_start_at, + inputs=WorkflowEntry.handle_special_values(node_run_result.inputs), + process_data=WorkflowEntry.handle_special_values(node_run_result.process_data), + outputs=WorkflowEntry.handle_special_values(node_run_result.outputs), + metadata=node_run_result.metadata, + llm_usage=node_run_result.llm_usage, error=node_run_result.error, - outputs=WorkflowEntry.handle_special_values(node_run_result.outputs) - if node_run_result.outputs - else None, retry_index=node_run_result.retry_index, - elapsed_time=time.perf_counter() - retry_start_at, - execution_metadata=WorkflowEntry.handle_special_values(node_run_result.metadata) - if node_run_result.metadata - else None, ) ) time.sleep(retry_interval)