uranusjr commented on code in PR #51920:
URL: https://github.com/apache/airflow/pull/51920#discussion_r2191495048
##########
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:
How about the query key in the URL? We should use singular there since it’ll
be used like this
```
https://.../wait?interval=100&result_task_id=op1&result_task_id=op2
```
This is a bit long to me, but not unacceptable. Would `result` work?
--
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]