diff --git a/docs/apache-airflow/modules_management.rst b/docs/apache-airflow/modules_management.rst index 0b5fc4001c1ab..f4b0005d625a4 100644 --- a/docs/apache-airflow/modules_management.rst +++ b/docs/apache-airflow/modules_management.rst @@ -103,8 +103,8 @@ This is an example structure that you might have in your ``dags`` folder: | | my_custom_dags | __init__.py - | my_dag_1.py - | my_dag_2.py + | my_dag1.py + | my_dag2.py | base_dag.py In the case above, there are the ways you could import the python files: @@ -123,7 +123,7 @@ shared code in the other folders, not the actual DAGs). In the example above the dags are only in ``my_custom_dags`` folder, the ``common_package`` should not be scanned by scheduler when searching for DAGS, so we should ignore ``common_package`` folder. You also -want to ignore the ``base_dag`` if you keep a base DAG there that ``my_dag1.py`` and ``my_dag1.py`` derives +want to ignore the ``base_dag.py`` if you keep a base DAG there that ``my_dag1.py`` and ``my_dag2.py`` derives from. Your ``.airflowignore`` should look then like this: .. code-block:: none @@ -186,7 +186,7 @@ You should import such shared dag using full path (starting from the directory w The relative imports are counter-intuitive, and depending on how you start your python code, they can behave differently. In Airflow the same DAG file might be parsed in different contexts (by schedulers, by workers -or during tests) and in those cases, relatives imports might behave differently. Always use full +or during tests) and in those cases, relative imports might behave differently. Always use full python package paths when you import anything in Airflow DAGs, this will save you a lot of troubles. You can read more about relative import caveats in `this Stack Overflow thread `_.