Skip to content

Commit

Permalink
Docs update: retries & note about Dagbag error (#592)
Browse files Browse the repository at this point in the history
Add retries of 2 to code samples
Add a note about the config variable to fix DagBag timeout errors
  • Loading branch information
TJaniF authored Oct 13, 2023
1 parent a426dd2 commit a85f2f1
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ You can render an Airflow Task Group using the ``DbtTaskGroup`` class. Here's an
with DAG(
dag_id="extract_dag",
start_date=datetime(2022, 11, 27),
schedule="@daily",
schedule_interval="@daily",
):
e1 = EmptyOperator(task_id="pre_dbt")
Expand Down
1 change: 1 addition & 0 deletions dev/dags/basic_cosmos_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@
start_date=datetime(2023, 1, 1),
catchup=False,
dag_id="basic_cosmos_dag",
default_args={"retries": 2},
)
# [END local_example]
1 change: 1 addition & 0 deletions dev/dags/basic_cosmos_task_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def basic_cosmos_task_group() -> None:
),
operator_args={"install_deps": True},
profile_config=profile_config,
default_args={"retries": 2},
)

post_dbt = EmptyOperator(task_id="post_dbt")
Expand Down
1 change: 1 addition & 0 deletions dev/dags/cosmos_manifest_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@
start_date=datetime(2023, 1, 1),
catchup=False,
dag_id="cosmos_manifest_example",
default_args={"retries": 2},
)
# [END local_example]
1 change: 1 addition & 0 deletions dev/dags/cosmos_profile_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def cosmos_profile_mapping() -> None:
),
),
operator_args={"install_deps": True},
default_args={"retries": 2},
)

post_dbt = EmptyOperator(task_id="post_dbt")
Expand Down
4 changes: 2 additions & 2 deletions dev/dags/cosmos_seed_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
with DAG(
dag_id="extract_dag",
start_date=datetime(2022, 11, 27),
schedule="@daily",
schedule_interval="@daily",
doc_md=__doc__,
catchup=False,
max_active_runs=1,
default_args={"owner": "01-EXTRACT"},
default_args={"owner": "01-EXTRACT", "retries": 2},
) as dag:
with TaskGroup(group_id="drop_seeds_if_exist") as drop_seeds:
for seed in ["raw_customers", "raw_payments", "raw_orders"]:
Expand Down
1 change: 1 addition & 0 deletions dev/dags/dbt_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def which_upload():
schedule_interval="@daily",
doc_md=__doc__,
catchup=False,
default_args={"retries": 2},
) as dag:
generate_dbt_docs_aws = DbtDocsS3Operator(
task_id="generate_dbt_docs_aws",
Expand Down
1 change: 1 addition & 0 deletions dev/dags/example_cosmos_python_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@
start_date=datetime(2023, 1, 1),
catchup=False,
dag_id="example_cosmos_python_models",
default_args={"retries": 2},
)
# [END example_cosmos_python_models]
1 change: 1 addition & 0 deletions dev/dags/example_model_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
start_date=datetime(2023, 1, 1),
catchup=False,
dag_id="example_model_version",
default_args={"retries": 2},
)
# [END local_example]
1 change: 1 addition & 0 deletions dev/dags/example_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@
start_date=datetime(2023, 1, 1),
catchup=False,
dag_id="example_virtualenv",
default_args={"retries": 2},
)
# [END virtualenv_example]
1 change: 1 addition & 0 deletions dev/dags/user_defined_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def user_defined_profile() -> None:
profiles_yml_filepath=PROFILES_FILE_PATH,
),
operator_args={"append_env": True, "install_deps": True},
default_args={"retries": 2},
)

post_dbt = EmptyOperator(task_id="post_dbt")
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/scheduling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Then, you can use Airflow's data-aware scheduling capabilities to schedule ``my_
project_two = DbtDag(
# ...
schedule=[get_dbt_dataset("my_conn", "project_one", "my_model")],
schedule_interval=[get_dbt_dataset("my_conn", "project_one", "my_model")],
dbt_project_name="project_two",
)
Expand Down
4 changes: 4 additions & 0 deletions docs/getting_started/astro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ In your ``my_cosmos_dag.py`` file, import the ``DbtDag`` class from Cosmos and c
start_date=datetime(2023, 1, 1),
catchup=False,
dag_id="my_cosmos_dag",
default_args={"retries": 2},
)
.. note::
In some cases, especially in larger dbt projects, you might run into a ``DagBag import timeout`` error.
This error can be resolved by increasing the value of the Airflow configuration `core.dagbag_import_timeout <https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#dagbag-import-timeout>`_.

Start your project
~~~~~~~~~~~~~~~~~~
Expand Down
6 changes: 6 additions & 0 deletions docs/getting_started/gcc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,10 @@ Make sure to rename the ``<your-adapter>`` value below to your adapter's Python
start_date=datetime(2023, 1, 1),
catchup=False,
dag_id="my_cosmos_dag",
default_args={"retries": 2},
)
.. note::
In some cases, especially in larger dbt projects, you might run into a ``DagBag import timeout`` error.
This error can be resolved by increasing the value of the Airflow configuration `core.dagbag_import_timeout <https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#dagbag-import-timeout>`_.
2 changes: 1 addition & 1 deletion docs/getting_started/kubernetes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Additional KubernetesPodOperator parameters can be added on the operator_args pa

For instance,

.. code-block:: text
.. code-block:: python
run_models = DbtTaskGroup(
profile_config=ProfileConfig(
Expand Down
6 changes: 6 additions & 0 deletions docs/getting_started/mwaa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,10 @@ In your ``my_cosmos_dag.py`` file, import the ``DbtDag`` class from Cosmos and c
start_date=datetime(2023, 1, 1),
catchup=False,
dag_id="my_cosmos_dag",
default_args={"retries": 2},
)
.. note::
In some cases, especially in larger dbt projects, you might run into a ``DagBag import timeout`` error.
This error can be resolved by increasing the value of the Airflow configuration `core.dagbag_import_timeout <https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#dagbag-import-timeout>`_.
6 changes: 6 additions & 0 deletions docs/getting_started/open-source.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,10 @@ For example, if you wanted to put your dbt project in the ``/usr/local/airflow/d
start_date=datetime(2023, 1, 1),
catchup=False,
dag_id="my_cosmos_dag",
default_args={"retries": 2},
)
.. note::
In some cases, especially in larger dbt projects, you might run into a ``DagBag import timeout`` error.
This error can be resolved by increasing the value of the Airflow configuration `core.dagbag_import_timeout <https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#dagbag-import-timeout>`_.
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ You can render an Airflow Task Group using the ``DbtTaskGroup`` class. Here's an
with DAG(
dag_id="extract_dag",
start_date=datetime(2022, 11, 27),
schedule="@daily",
schedule_interval="@daily",
):
e1 = EmptyOperator(task_id="pre_dbt")
dbt_tg = DbtTaskGroup(
project_config=ProjectConfig("jaffle_shop"),
profile_config=profile_config,
default_args={"retries": 2},
)
e2 = EmptyOperator(task_id="post_dbt")
Expand Down

0 comments on commit a85f2f1

Please sign in to comment.