Skip to content

Latest commit

 

History

History
40 lines (22 loc) · 736 Bytes

23592.significant.rst

File metadata and controls

40 lines (22 loc) · 736 Bytes

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):

...