简体   繁体   English

无法删除 Airflow 中的旧 dag

[英]Impossible to delete old dags in Airflow

I am trying to delete some old dags in airflow.我正在尝试删除 airflow 中的一些旧 dag。 I know that since Airflow 1.10.1 you can delete them using the UI.我知道从 Airflow 1.10.1 开始,您可以使用 UI 删除它们。

在此处输入图像描述

Depite clicking in the red cross, airflow makes as it deletes the dag but later on it reapears.尽管点击了红叉,airflow 在删除 dag 时会执行此操作,但随后会重新出现。

As I have acces to the DB I tried to delete some dags using:由于我可以访问数据库,因此我尝试使用以下方法删除一些 dag:

delete from task_fail  where dag_id='';
delete from task_instance where dag_id ='';
delete from serialized_dag  where dag_id='';
delete from xcom where dag_id='';
delete from log where dag_id='';
delete from dag_tag where dag_id='';
delete from job where dag_id='';
delete from task_reschedule where dag_id ='';
delete from sla_miss where dag_id ='';
delete from dag_run where dag_id='';
delete from dag where dag_id ='';

It do the sames as the UI, dissapears and later on reappear.它与 UI 一样,消失,然后重新出现。

I read that it uses file_name to recreate the dag despite change the dag name on the file.我读到它使用file_name来重新创建 dag,尽管更改了文件上的 dag 名称。

For instance:例如:

my_file.py --> Dag_id= MY_DAG_ID my_file.py --> Dag_id= MY_DAG_ID

my_file.py --> Dag_id= MY_NEW_DAG_ID my_file.py --> Dag_id= MY_NEW_DAG_ID

It will show two dags, MY_DAG_ID & MY_NEW_DAG_ID, and i can't delete MY_DAG_ID.它将显示两个 dag,MY_DAG_ID 和 MY_NEW_DAG_ID,我无法删除 MY_DAG_ID。

How can I solve that?我该如何解决? The only way is to rename or create a new file for the new dag?唯一的方法是为新的 dag 重命名或创建一个新文件?

what version of airflow are you running?你在运行什么版本的 airflow? When I delete it from the UI it asks me to remove the DAG file from my volume.当我从 UI 中删除它时,它会要求我从我的卷中删除 DAG 文件。 I do that and then after sometime(based on your dag refresh interval) it cleans up the DAG.我这样做,然后在一段时间后(基于您的 dag 刷新间隔)它会清理 DAG。 So steps are所以步骤是

  • delete from UI using the red button使用红色按钮从 UI 中删除
  • Remove the DAG file from the volume which is being scanned periodically.从定期扫描的卷中删除 DAG 文件。

Let me know.让我知道。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM