'How to handle 'Default_args' error in Airflow?

I am getting this error:

Broken DAG: [/usr/local/airflow/dags/reg_controller_new.py] type object 'DAG' has no attribute 'default_args'

I didn't find anything sufficient on google which can help me to figure out this issue.



Solution 1:[1]

In my case, it was a bad copy/paste from another StackOverflow question. I copied the following operator

t3 = PythonOperator(
    task_id=t3_id,
    python_callable=pull_function,
    provide_context=True,
    dag=DAG
)

And didn't notice that it sad DAG (the class) instead of dag (the instantiated variable with default_args already set). After changing DAG to dag the error disappeared.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alechan