XD-DENG commented on a change in pull request #4287: [AIRFLOW-3479] Keeps records in Log Table when delete DAG & refine related tests URL: https://github.com/apache/incubator-airflow/pull/4287#discussion_r239656929
########## File path: airflow/api/common/experimental/delete_dag.py ########## @@ -41,6 +49,8 @@ def delete_dag(dag_id): # noinspection PyUnresolvedReferences,PyProtectedMember for m in models.Base._decl_class_registry.values(): if hasattr(m, "dag_id"): + if keep_records_in_log and m.__name__ == 'Log': Review comment: Hi @feng-tao , regarding your questions: 1. `delete_dag()` function does not touch the log files (plain text files in `/log` folder) at all. It only deletes records of given dag_id in the tables in the backend database, including "dag", "task_instance", "dag_run", etc. (actually all tables in which `dag_id` is available). Earlier it also deletes the records in "log" table in the database, which may not be ideal (logs should not be touched by anyone other than Admin). This is what this PR is trying to solve. 1. The behaviour (API vs webserver/UI) will be consistent: when a user deletes a DAG from UI, what happens under the hood is that the URL of the button will invoke the API endpoint with the _default_ parameter (`keep_records_in_log=True`). The only difference is that users can delete records in `log` table using API if they want (of course they need to explicitly specify `keep_records_in_log=False`). Please let me know if you need any other clarification. Thanks for reviewing! ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services