mirror of
https://github.com/langgenius/dify.git
synced 2026-04-28 20:17:29 +08:00
fix(api): fix relations of WorkflowNodeExecutionModel not preloaded
`WorkflowNodeExecutionModel.offload_data` should be preloaded to provide info about the offloading information of execution record. The `RagPipelineService.get_node_last_run` does not utilize `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` so the loading logics is not changed. In the commit we migrate to calling `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` to avoid such issue.
This commit is contained in:
parent
e761f38d26
commit
d2e341367e
@ -1162,18 +1162,15 @@ class RagPipelineService:
|
|||||||
def get_node_last_run(
|
def get_node_last_run(
|
||||||
self, pipeline: Pipeline, workflow: Workflow, node_id: str
|
self, pipeline: Pipeline, workflow: Workflow, node_id: str
|
||||||
) -> WorkflowNodeExecutionModel | None:
|
) -> WorkflowNodeExecutionModel | None:
|
||||||
# TODO(QuantumGhost): This query is not fully covered by index.
|
node_execution_service_repo = DifyAPIRepositoryFactory.create_api_workflow_node_execution_repository(
|
||||||
criteria = (
|
sessionmaker(db.engine)
|
||||||
WorkflowNodeExecutionModel.tenant_id == pipeline.tenant_id,
|
|
||||||
WorkflowNodeExecutionModel.app_id == pipeline.id,
|
|
||||||
WorkflowNodeExecutionModel.workflow_id == workflow.id,
|
|
||||||
WorkflowNodeExecutionModel.node_id == node_id,
|
|
||||||
)
|
)
|
||||||
node_exec = (
|
|
||||||
db.session.query(WorkflowNodeExecutionModel)
|
node_exec = node_execution_service_repo.get_node_last_execution(
|
||||||
.filter(*criteria)
|
tenant_id=pipeline.tenant_id,
|
||||||
.order_by(WorkflowNodeExecutionModel.created_at.desc())
|
app_id=pipeline.id,
|
||||||
.first()
|
workflow_id=workflow.id,
|
||||||
|
node_id=node_id,
|
||||||
)
|
)
|
||||||
return node_exec
|
return node_exec
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user