uranusjr commented on a change in pull request #17980:
URL: https://github.com/apache/airflow/pull/17980#discussion_r701716844
##########
File path: airflow/api_connexion/endpoints/dag_endpoint.py
##########
@@ -100,3 +102,20 @@ def patch_dag(session, dag_id, update_mask=None):
setattr(dag, 'is_paused', patch_body['is_paused'])
session.commit()
return dag_schema.dump(dag)
+
+
[email protected]_access([(permissions.ACTION_CAN_DELETE,
permissions.RESOURCE_DAG)])
+@provide_session
+def delete_dag(dag_id: str, session: Session):
+ """Delete the specific DAG."""
+ # TODO: This function is shared with the /delete endpoint used by the web
+ # UI, so we're reusing it to simplify maintenance. Refactor the function to
+ # another place when the experimental/legacy API is removed.
+ from airflow.api.common.experimental import delete_dag
+
+ try:
+ delete_dag.delete_dag(dag_id, session=session)
+ except DagNotFound:
+ raise NotFound(f"Dag with id: '{dag_id}' not found")
+
Review comment:
Yes except that brings back the 409 issue 🙃
It also feels curious to me the web UI does not seem to handle this
exception. Do we just get a 500 when that happens?
--
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]