Commit 4f5c052d authored by takatost's avatar takatost

fix single step run error

parent 15ddbb5e
...@@ -270,28 +270,48 @@ class WorkflowService: ...@@ -270,28 +270,48 @@ class WorkflowService:
return workflow_node_execution return workflow_node_execution
# create workflow node execution if node_run_result.status == WorkflowNodeExecutionStatus.SUCCEEDED:
workflow_node_execution = WorkflowNodeExecution( # create workflow node execution
tenant_id=app_model.tenant_id, workflow_node_execution = WorkflowNodeExecution(
app_id=app_model.id, tenant_id=app_model.tenant_id,
workflow_id=draft_workflow.id, app_id=app_model.id,
triggered_from=WorkflowNodeExecutionTriggeredFrom.SINGLE_STEP.value, workflow_id=draft_workflow.id,
index=1, triggered_from=WorkflowNodeExecutionTriggeredFrom.SINGLE_STEP.value,
node_id=node_id, index=1,
node_type=node_instance.node_type.value, node_id=node_id,
title=node_instance.node_data.title, node_type=node_instance.node_type.value,
inputs=json.dumps(node_run_result.inputs) if node_run_result.inputs else None, title=node_instance.node_data.title,
process_data=json.dumps(node_run_result.process_data) if node_run_result.process_data else None, inputs=json.dumps(node_run_result.inputs) if node_run_result.inputs else None,
outputs=json.dumps(node_run_result.outputs) if node_run_result.outputs else None, process_data=json.dumps(node_run_result.process_data) if node_run_result.process_data else None,
execution_metadata=(json.dumps(jsonable_encoder(node_run_result.metadata)) outputs=json.dumps(node_run_result.outputs) if node_run_result.outputs else None,
if node_run_result.metadata else None), execution_metadata=(json.dumps(jsonable_encoder(node_run_result.metadata))
status=WorkflowNodeExecutionStatus.SUCCEEDED.value, if node_run_result.metadata else None),
elapsed_time=time.perf_counter() - start_at, status=WorkflowNodeExecutionStatus.SUCCEEDED.value,
created_by_role=CreatedByRole.ACCOUNT.value, elapsed_time=time.perf_counter() - start_at,
created_by=account.id, created_by_role=CreatedByRole.ACCOUNT.value,
created_at=datetime.utcnow(), created_by=account.id,
finished_at=datetime.utcnow() created_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