ferruzzi commented on code in PR #75253:
URL: https://github.com/apache/airflow/pull/75253#discussion_r4449255268


##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/callbacks.py:
##########
@@ -83,3 +86,47 @@ def run_callback(
     callback.state = CallbackState.RUNNING
 
     issue_execution_token(services, response, sub=str(callback_id))
+
+
[email protected](
+    "/{callback_id}/state",
+    status_code=status.HTTP_204_NO_CONTENT,
+    responses=create_openapi_http_exception_doc(
+        [
+            (status.HTTP_404_NOT_FOUND, "Callback not found"),
+            (status.HTTP_409_CONFLICT, "The callback is not running"),
+        ]
+    ),
+)
+def update_callback_state(
+    callback_id: UUID,
+    payload: Annotated[CallbackTerminalStatePayload, Body()],
+    session: SessionDep,
+) -> None:
+    """Report the final state of a callback that has finished running."""
+    callback = session.get(Callback, callback_id, with_for_update=True)
+    if callback is None:
+        raise HTTPException(
+            status_code=status.HTTP_404_NOT_FOUND,
+            detail={
+                "reason": "not_found",
+                "message": f"Callback {callback_id} not found",
+            },
+        )
+
+    if callback.state != CallbackState.RUNNING:

Review Comment:
   I think that makes sense, I'll make the change.



-- 
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]

Reply via email to