-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure Airflow tasks using dbt model meta (#1339)
The various dbt models have unique characteristics, and some may require the use of custom pools, queues, or other specific configurations. To support such cases, this update introduces the ability to add necessary information in the meta section of the dbt model.yaml. This metadata is then passed as kwargs to the corresponding Airflow tasks, enabling model-specific customization and enhanced task configuration. **here is sample** DbtTaskGroup - default_args for all dbt models ```python dbt_task_group = DbtTaskGroup( project_config=, profile_config=ProfileConfig, default_args={'pool': dbt_pool} ) ``` ```yaml version: 2 models: - name: name description: description meta: owner: '[email protected]' cosmos: pool: abcd ``` **result** general pool ![스크린샷 2024-11-25 오후 10 15 26](https://github.com/user-attachments/assets/ea492a19-488f-4dbb-b4b9-2be20dc191be) custom pool ![스크린샷 2024-11-25 오후 10 15 40](https://github.com/user-attachments/assets/f6055cc0-94f6-4789-9b05-4e02e34bcd5f) ## Related Issue(s) Closes: #881 Closes: #1325
- Loading branch information
Showing
7 changed files
with
110 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.. _custom-airflow-properties: | ||
|
||
Airflow Configuration Overrides with Astronomer Cosmos | ||
====================================================== | ||
|
||
**Astronomer Cosmos** allows you to override Airflow configurations for each dbt task (dbt operator) via the dbt YAML file. | ||
|
||
Sample dbt Model YAML | ||
++++++++++++ | ||
|
||
.. code-block:: yaml | ||
version: 2 | ||
models: | ||
- name: name | ||
description: description | ||
meta: | ||
cosmos: | ||
operator_args: | ||
pool: abcd | ||
Explanation | ||
++++++++++++ | ||
|
||
By adding Airflow configurations under **cosmos** in the **meta** field, you can set independent Airflow configurations for each task. | ||
For example, in the YAML above, the **pool** setting is applied to the specific dbt task. | ||
This approach allows for more granular control over Airflow settings per task within your dbt model definitions. | ||
|
||
.. image:: ../_static/custom_airflow_pool.png | ||
:alt: Result of applying Custom Airflow Pool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters