uranusjr commented on code in PR #51920:
URL: https://github.com/apache/airflow/pull/51920#discussion_r2194068145
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py:
##########
@@ -433,6 +437,57 @@ def trigger_dag_run(
raise HTTPException(status.HTTP_400_BAD_REQUEST, str(e))
+@dag_run_router.get(
+ "/{dag_run_id}/wait",
+ tags=["experimental"],
+ summary="Experimental: Wait for a dag run to complete, and return task
results if requested.",
+ description="🚧 This is an experimental endpoint and may change or be
removed without notice.",
+ responses={
+ **create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]),
+ status.HTTP_200_OK: {
+ "description": "Successful Response",
+ "content": {
+ Mimetype.NDJSON: {
+ "schema": {
+ "type": "string",
+ "example": textwrap.dedent(
+ """\
+ {"state": "running"}
+ {"state": "success", "returns": {"op": 42}}
+ """
+ ),
+ }
+ }
+ },
+ },
+ },
+ dependencies=[Depends(requires_access_dag(method="GET",
access_entity=DagAccessEntity.RUN))],
+)
+def wait_dag_run_until_finished(
+ dag_id: str,
+ dag_run_id: str,
+ session: SessionDep,
+ interval: Annotated[float, Query(gt=0.0, description="Seconds to wait
between dag run state checks")],
+ collect_task_ids: Annotated[
+ list[str] | None,
+ Query(alias="collect", description="Collect return value XCom from
task. Can be set multiple times."),
Review Comment:
Changed to `result`. Also changed the key used in the response to `results`
to match.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]