Commit 4f5c052d authored by takatost's avatar takatost

fix single step run error

parent 15ddbb5e
...@@ -270,6 +270,7 @@ class WorkflowService: ...@@ -270,6 +270,7 @@ class WorkflowService:
return workflow_node_execution return workflow_node_execution
if node_run_result.status == WorkflowNodeExecutionStatus.SUCCEEDED:
# create workflow node execution # create workflow node execution
workflow_node_execution = WorkflowNodeExecution( workflow_node_execution = WorkflowNodeExecution(
tenant_id=app_model.tenant_id, tenant_id=app_model.tenant_id,
...@@ -292,6 +293,25 @@ class WorkflowService: ...@@ -292,6 +293,25 @@ class WorkflowService:
created_at=datetime.utcnow(), created_at=datetime.utcnow(),
finished_at=datetime.utcnow() finished_at=datetime.utcnow()
) )
else:
# create workflow node execution
workflow_node_execution = WorkflowNodeExecution(
tenant_id=app_model.tenant_id,
app_id=app_model.id,
workflow_id=draft_workflow.id,
triggered_from=WorkflowNodeExecutionTriggeredFrom.SINGLE_STEP.value,
index=1,
node_id=node_id,
node_type=node_instance.node_type.value,
title=node_instance.node_data.title,
status=node_run_result.status.value,
error=node_run_result.error,
elapsed_time=time.perf_counter() - start_at,
created_by_role=CreatedByRole.ACCOUNT.value,
created_by=account.id,
created_at=datetime.utcnow(),
finished_at=datetime.utcnow()
)
db.session.add(workflow_node_execution) db.session.add(workflow_node_execution)
db.session.commit() db.session.commit()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment