user14274451
user14274451

Reputation:

Apache Airflow problem - "a task with task_id create_tag_template_field_result is already in the DAG"

So, I have a problem with even the blank Airflow installation.

As soon as I try to run

airflow test tutorial print_date 2015-06-01

I get a raised exception which says

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.

What is the reason for this (as I made literally no changes to the installation whatsoever)?

I also got that when, in a previous installation, I tried to run my own dag... but the "create_tag_template_field_result" was nowhere to be found in my code.

Upvotes: 7

Views: 3524

Answers (3)

cs16
cs16

Reputation: 66

you can set the config arg load_examples = False to solve it.

This is the test command will call get_dag function which will construct a DagBag object, in the construction function will call collect_dags function. The collect_dags function when the conf arg LOAD_EXAMPLES=True(default True), will collect all the dags in the example path, that's where the task create_tag_template_field_result comes from.
And in the collect_dags function will call add_task function of every example task, that's where you add the create_tag_template_field_result task again. And maybe it's quickstart when you added this task before for the first time while you didn't realize.
you can set the config arg load_examples = False to solve it

Upvotes: 3

user14722613
user14722613

Reputation: 11

This warning is occuring in /usr/local/lib/python3.7/dist-packages/airflow/example_dags/example_complex.py so i remove or rename (for example, to not working name *.py.back ) this.

Upvotes: 1

Childish Chimpino
Childish Chimpino

Reputation: 11

I had the same error with a fresh install.

Then I don't know if this helps, but I downgraded Airflow to version 1.10.10 (with python3.7) and the error was gone.

Upvotes: 0

Related Questions