DAGS used in a context manager no longer need to be assigned to a module variable
Previously you had do assign a DAG to a module-level variable in order for Airflow to pick it up. For example this
with DAG(dag_id="example") as dag:
...
@dag
def dag_maker():
...
dag2 = dag_maker()
can become
with DAG(dag_id="example"):
...
@dag
def dag_maker():
...
dag_maker()
If you want to disable the behaviour for any reason then set auto_register=False
on the dag:
.. code-block::
# This dag will not be picked up by Airflow as it's not assigned to a variable with DAG(dag_id="example", auto_register=False):
...