bbovenzi commented on code in PR #23451:
URL: https://github.com/apache/airflow/pull/23451#discussion_r873992709


##########
airflow/api_connexion/endpoints/dag_run_endpoint.py:
##########
@@ -312,3 +317,54 @@ def update_dag_run_state(*, dag_id: str, dag_run_id: str, 
session: Session = NEW
         set_dag_run_state_to_failed(dag=dag, run_id=dag_run.run_id, 
commit=True)
     dag_run = session.query(DagRun).get(dag_run.id)
     return dagrun_schema.dump(dag_run)
+
+
[email protected]_access(
+    [
+        (permissions.ACTION_CAN_READ, permissions.RESOURCE_DAG),
+        (permissions.ACTION_CAN_EDIT, permissions.RESOURCE_DAG_RUN),
+    ],
+)
+@provide_session
+def clear_dag_run(*, dag_id: str, dag_run_id: str, session: Session = 
NEW_SESSION) -> APIResponse:
+    """Clear a dag run."""
+    dag_run: Optional[DagRun] = (
+        session.query(DagRun).filter(DagRun.dag_id == dag_id, DagRun.run_id == 
dag_run_id).one_or_none()
+    )
+    if dag_run is None:
+        error_message = f'Dag Run id {dag_run_id} not found in dag {dag_id}'
+        raise NotFound(error_message)

Review Comment:
   Nevermind, I see we do this all over the place.



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