在apache airflow 2.0中是否可以避免此警告?
我在Windows10WSL(Ubuntu20.04)上使用的是气流v2.0。 警告信息是:在apache airflow 2.0中是否可以避免此警告?,airflow,Airflow,我在Windows10WSL(Ubuntu20.04)上使用的是气流v2.0。 警告信息是: /home/jainri/.local/lib/python3.8/site-packages/airflow/models/dag.py:1342: PendingDeprecationWarning: The requested task could not be added to the DAG because a task with task_id create_tag_template_fie
/home/jainri/.local/lib/python3.8/site-packages/airflow/models/dag.py:1342: PendingDeprecationWarning: The requested task could not be added to the DAG because a task with task_id create_tag_template_field_result is already in the DAG. Starting in Airflow 2.0, trying to overwrite a task will raise an exception.
warnings.warn(
Done.
由于此警告,web UI中显示的DAG也是apache airflow中包含的一些示例DAG。我已经设置了**AIRFLOW\u HOME**,它还从那里接收DAG。但示例DAG的列表也显示出来。我还发布了WEB UI的图像。
这是下面我正在尝试运行的dag:
导入日期时间
导入日志记录
从气流导入DAG
从afflow.operators.python_operator导入PythonOperator
#
#TODO:定义python操作符要调用的函数
#
def greet():
logging.info(“Hello Rishabh!!”)
dag=dag(
“第1课演示1”,
start_date=datetime.datetime.now()
结束日期
)
#
#TODO:使用PythonOperator定义下面的任务
#
greet_task=PythonOperator(
task_id='greet_task',
python_callable=greet,
dag=dag
)
另外,主要问题是webUI中显示的DAG列表是一些示例DAG。这和我自己的DAG一起显示了一个巨大的列表。这使得查找我自己的DAG变得很麻烦。我发现了这个问题,您看到的错误是因为气流/example\u dags/example\u complex.py(其中一个示例DAG)随气流一起提供的
通过将
aiffort\uu CORE\uu LOAD\u EXAMPLES=False
设置为环境变量或在aiffort.cfg
()中设置[CORE]LOAD\u EXAMPLES=False
来禁用示例数据的加载。请不要将文本作为图像发布。编辑您的问题并使其可索引我已根据您的建议编辑了我的问题。谢谢你,奥拉夫。请把你的实际情况公布出来DAG@kaxil我已经发布了我的dag。请注意,这将在Airflow 2.0版本中修复。目前,唯一的alpha版本正在测试中,不应在生产中使用。根据您的回答,在编辑airflow.cfg后,我使用airflow initdb
重置加载到airflow web UI中的DAG列表,它起了作用。