On Fri, 29 Apr 2022 at 06:38, Thomas Grainger <tagr...@gmail.com> wrote: > Can you show a run-able example of the successful and unsuccessful usage of > `with DAG(): ... `?
from airflow import DAG # correct: dag = DAG("my_dag") # incorrect: DAG("my_dag") The with construct really has nothing to do with it, but it is a common source of confusion: # incorrect with DAG("my_dag"): ... It is less obvious (to some) in this way that the entire DAG will not be picked up. You will in fact have to write: # correct with DAG("my_dag") as dag: ... This way, you're capturing the DAG in the top-level scope which is the requirement. _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/HREOTTGPB5JMLGYMIQL4VR2DFI6GBG5J/ Code of Conduct: http://python.org/psf/codeofconduct/