-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add setup task for async executions (#1518)
This PR reintroduces the setup task for ExecutionMode.AIRFLOW_ASYNC, This will prevent the execution of the dbt command for each Airflow task node for run operator and will only run the dbt command mock version for start job node. Additionally, a new configuration, `enable_setup_task`, has been introduced to enable or disable this feature. **With enable_setup_task** <img width="1686" alt="Screenshot 2025-02-08 at 9 53 35 PM" src="https://github.com/user-attachments/assets/cb9daf76-2bd6-4bcf-8219-b64562c4151a" /> **Without enable_setup_task** <img width="1668" alt="Screenshot 2025-02-08 at 10 23 49 PM" src="https://github.com/user-attachments/assets/4ac99c3b-15df-484e-b9e4-cc7b1022ea31" /> Related-to: #1477
- Loading branch information
1 parent
0fd61c3
commit 577c08e
Showing
12 changed files
with
168 additions
and
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
from airflow.utils.context import Context | ||
|
||
from cosmos.operators.local import DbtRunLocalOperator as DbtRunOperator | ||
|
||
|
||
class SetupAsyncOperator(DbtRunOperator): | ||
def __init__(self, *args: Any, **kwargs: Any): | ||
kwargs["emit_datasets"] = False | ||
super().__init__(*args, **kwargs) | ||
|
||
def execute(self, context: Context, **kwargs: Any) -> None: | ||
async_context = {"profile_type": self.profile_config.get_profile_type()} | ||
self.build_and_run_cmd( | ||
context=context, cmd_flags=self.dbt_cmd_flags, run_as_async=True, async_context=async_context | ||
) |
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
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
Oops, something went wrong.