forked from astronomer/astronomer-cosmos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend VirtualEnv operator and mock dbt adapters for setup & teardown…
… tasks in ExecutionMode.AIRFLOW_ASYNC (astronomer#1544) ## Summary This PR extends the `DbtRunVirtualenvOperator` to the setup and teardown tasks for `ExecutionMode.AIRFLOW_ASYNC`. It ensures that dbt adapters are installed in the virtualenv created by the `DbtRunVirtualenvOperator` and are properly mocked within the virtual environment. ## Key Changes ✅ **Extending SetupAsyncOperator and TeardownAsyncOperator with DbtRunVirtualenvOperator and mocking dbt adapters** - These operators inherit from `DbtRunVirtualenvOperator` and override `run_subprocess`. - The operators extract the mock function from the appropriate `cosmos.operators._asynchronous` module. - The extracted function is injected dynamically into the dbt CLI entry script within the virtual environment, so that mocked dbt adapters get called before executing dbt commands. ✅ **Decoupled dbt Adapters from Airflow Environment** - With this change, dbt adapters (e.g., `dbt-bigquery`, `dbt-postgres`) no longer need to be installed in the same environment as the Airflow installation. - The `ExecutionConfig` now exposes `async_py_requirements` which can be set by DAG authors, ensuring that the necessary dbt dependencies are installed inside the virtual environment for `ExecutionMode.AIRFLOW_ASYNC`. closes: astronomer#1533 --------- Co-authored-by: Tatiana Al-Chueyr <tatiana.alchueyr@gmail.com> Co-authored-by: Pankaj Singh <98807258+pankajastro@users.noreply.github.com>
- Loading branch information
1 parent
968b80e
commit 6ddc3c2
Showing
10 changed files
with
234 additions
and
12 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
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.