-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create single virtualenv when
DbtVirtualenvBaseOperator
has `virtua…
…lenv_dir=None` and `is_virtualenv_dir_temporary=True` (#1200) ## Description This PR optimizes the `DbtVirtualenvBaseOperator` by implementing virtualenv reuse within a single task execution. It reduces the overhead of creating new virtualenvs for each dbt command. The `DbtVirtualenvBaseOperator` in [email protected] creates a temporary directory and prepares a virtualenv twice when `virtualenv_dir` is `None` and `is_virtualenv_dir_temporary` is `True`. This PR modifies it to create a directory and a virtualenv only once at the beginning of the `run_command` method, avoiding this overhead. Additionally, I have added tests to ensure the directory for virtualenv will be deleted after the task execution. This is related to the issue reported in #958. The changes include: - Reusing virtualenv in a single task execution - Improving temporary directory management - Adding tests to ensure proper handling of virtualenv directories (deletion or persistence) ## Related Issue(s) #958 ## Breaking Change? I believe this is not a breaking change. ## Checklist - [x] I have made corresponding changes to the documentation (if required) - [x] I have added tests that prove my fix is effective or that my feature works
- Loading branch information
1 parent
7eb9386
commit 225d6e9
Showing
2 changed files
with
66 additions
and
43 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