bbovenzi commented on a change in pull request #17980:
URL: https://github.com/apache/airflow/pull/17980#discussion_r701773251
##########
File path: airflow/api_connexion/endpoints/dag_endpoint.py
##########
@@ -100,3 +102,22 @@ 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")
+ except AirflowException:
+ raise AlreadyExists(detail=f"Task instances of fag with id: '{dag_id}'
are still running")
Review comment:
```suggestion
raise AlreadyExists(detail=f"Task instances of dag with id:
'{dag_id}' are still running")
```
typo
--
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]