-
Notifications
You must be signed in to change notification settings - Fork 296
Introduce ExecutionMode.WATCHER to reduce DAG run time by 1/5
#1999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
daf08f7
Add DbtModelStatusSensor for the proposed ExecutionMode.WATCHER
pankajastro 2924023
Introduce ExecutionMode.WATCHER
tatiana b7bcd12
Adjustments after rebase
tatiana 1f8950e
Fix watcher unit tests, revert to version on main
tatiana 0d6088a
Fix minor issues
tatiana d0ccd5f
Merge branch 'main' into 1964-execution-mode-watcher
tatiana 5875141
Merge branch 'main' into 1964-execution-mode-watcher
tatiana 2719484
Add watcher example DAG
tatiana 66ff659
Fix dbt project hash locally in test graph
tatiana a411de9
Revert uninteded rebase change that was breaking unittests
tatiana 8c1b63f
Remove unnecessary blank line
tatiana db54d17
Fix mypy check
tatiana d992386
Try to fix integration tests that failed
tatiana 99d165f
Try to improve test coverage
tatiana b980b69
Improve test coverage
tatiana 63e5d7f
Add test to confirm topology and how watcher DAG is built
tatiana 8c0cb15
Try to fix test that did not work in CI
tatiana 5c4990b
Fix integration test
tatiana 1e1c2c1
Fix weight of consumer tasks
tatiana 1f2dcb3
Fix CI
tatiana 3d1f5b0
Update tests/operators/test_watcher.py
tatiana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,59 @@ | ||
| """ | ||
| An example DAG that uses Cosmos to render a dbt project into an Airflow DAG. | ||
| """ | ||
|
|
||
| import os | ||
| from datetime import datetime, timedelta | ||
| from pathlib import Path | ||
|
|
||
| # [START cosmos_init_imports] | ||
| from cosmos import DbtDag, ExecutionConfig, ProfileConfig, ProjectConfig | ||
| from cosmos.constants import ExecutionMode | ||
|
|
||
| # [END cosmos_init_imports] | ||
| from cosmos.profiles import PostgresUserPasswordProfileMapping | ||
|
|
||
| DEFAULT_DBT_ROOT_PATH = Path(__file__).parent / "dbt" | ||
| DBT_ROOT_PATH = Path(os.getenv("DBT_ROOT_PATH", DEFAULT_DBT_ROOT_PATH)) | ||
| DBT_PROJECT_NAME = os.getenv("DBT_PROJECT_NAME", "jaffle_shop") | ||
| DBT_PROJECT_PATH = DBT_ROOT_PATH / DBT_PROJECT_NAME | ||
|
|
||
|
|
||
| profile_config = ProfileConfig( | ||
| profile_name="default", | ||
| target_name="dev", | ||
| profile_mapping=PostgresUserPasswordProfileMapping( | ||
| conn_id="example_conn", | ||
| profile_args={"schema": "public"}, | ||
| disable_event_tracking=True, | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| operator_args = { | ||
| "install_deps": True, # install any necessary dependencies before running any dbt command | ||
| "execution_timeout": timedelta(seconds=120), | ||
| } | ||
|
|
||
| # Currently airflow dags test ignores priority_weight and weight_rule, for this reason, we're setting the following in the CI only: | ||
| if os.getenv("CI"): | ||
| operator_args["trigger_rule"] = "all_success" | ||
|
|
||
|
|
||
| # [START example_watcher] | ||
| example_watcher = DbtDag( | ||
| # dbt/cosmos-specific parameters | ||
| execution_config=ExecutionConfig( | ||
| execution_mode=ExecutionMode.WATCHER, | ||
| ), | ||
| project_config=ProjectConfig(DBT_PROJECT_PATH), | ||
| profile_config=profile_config, | ||
| operator_args=operator_args, | ||
| # normal dag parameters | ||
| schedule="@daily", | ||
| start_date=datetime(2023, 1, 1), | ||
| catchup=False, | ||
| dag_id="example_watcher", | ||
| default_args={"retries": 0}, | ||
| ) | ||
| # [END example_watcher] |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.