handle workflow run cancel for child workflow runs / task v2 + observer cancel handling (#1776)

This commit is contained in:
Shuchang Zheng
2025-02-18 23:21:17 +08:00
committed by GitHub
parent 30ae63bae9
commit 4df0daa2ea
3 changed files with 93 additions and 18 deletions

View File

@@ -1511,6 +1511,24 @@ class AgentDB:
LOG.error("SQLAlchemyError", exc_info=True)
raise
async def get_workflow_runs_by_parent_workflow_run_id(
self,
organization_id: str,
parent_workflow_run_id: str,
) -> list[WorkflowRun]:
try:
async with self.Session() as session:
query = (
select(WorkflowRunModel)
.filter(WorkflowRunModel.organization_id == organization_id)
.filter(WorkflowRunModel.parent_workflow_run_id == parent_workflow_run_id)
)
workflow_runs = (await session.scalars(query)).all()
return [convert_to_workflow_run(run) for run in workflow_runs]
except SQLAlchemyError:
LOG.error("SQLAlchemyError", exc_info=True)
raise
async def create_workflow_parameter(
self,
workflow_id: str,