Skip to content

Commit

Permalink
fix: Add missing information for step-by-step debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Novice Lee authored and Novice Lee committed Dec 20, 2024
1 parent 204d314 commit 280cc67
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
8 changes: 1 addition & 7 deletions api/core/workflow/nodes/event/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
10 changes: 6 additions & 4 deletions api/fields/workflow_run_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}


Expand Down
16 changes: 6 additions & 10 deletions api/services/workflow_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 280cc67

Please sign in to comment.