ephraimbuddy commented on code in PR #60012:
URL: https://github.com/apache/airflow/pull/60012#discussion_r2660739199
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py:
##########
@@ -138,6 +138,15 @@ def delete_dag_run(dag_id: str, dag_run_id: str, session:
SessionDep):
status.HTTP_404_NOT_FOUND,
f"The DagRun with dag_id: `{dag_id}` and run_id: `{dag_run_id}`
was not found",
)
+
+ # Only allow deletion if dag_run.state is in DAGRunPatchStates
+ allowed_states = {state.value for state in DAGRunPatchStates}
+ if dag_run.state not in allowed_states:
+ raise HTTPException(
+ status.HTTP_400_BAD_REQUEST,
+ f"Cannot delete DagRun in state '{dag_run.state}'. Only allowed in
states: {', '.join(allowed_states)}."
+ )
Review Comment:
Seems there's some mix up here with your other PR
--
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]