Introduce ExecutionMode.WATCHER_KUBERNETES to use watcher with KubernetesPodOperator#2207
Merged
Conversation
✅ Deploy Preview for astronomer-cosmos canceled.
|
4ef6afc to
c7b0b82
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2207 +/- ##
==========================================
+ Coverage 97.97% 98.03% +0.05%
==========================================
Files 97 98 +1
Lines 6273 6352 +79
==========================================
+ Hits 6146 6227 +81
+ Misses 127 125 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
pankajastro
reviewed
Jan 6, 2026
Collaborator
Author
|
Thanks a lot for the reviews, @johnhoran @pankajkoti @pankajastro - I think I addressed most, if not all, of them |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
pankajastro
approved these changes
Jan 6, 2026
pankajkoti
approved these changes
Jan 7, 2026
Contributor
pankajkoti
left a comment
There was a problem hiding this comment.
LGTM. Couple of questions inline
1 task
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Introduce
ExecutionMode.WATCHER_KUBERNETES, allowing users to use the Producer/Consumer approach without requiring dbt to be installed in the same environment as Airflow.This PR includes an example DAG illustrating the use-case.
Given an existing bug in the latest releases of
apache-airflow-providers-cncf-kubernetes(apache/airflow#59366), we had to subclass theKubernetesPodManagerclass and override a method. This may not be needed once the fix is merged and the new provider version is released. Given this issue, we have tested and successfully validated the usage of this execution mode with the following versions ofapache-airflow-providers-cncf-kubernetesWhy
There is significant overhead each time a K8S Pod is spawned and when the dbt project is parsed.
Cosmos
ExecutionMode.WATCHER(docs) has delivered significant performance improvements for users who were previously usingExecutionMode.LOCAL; however, some users need to keep Airflow and dbt dependencies isolated.This PR extends the
ExecutionMode.WATCHERperformance gains to Kubernetes.Comparison of the same dbt project DAG run with Jaffle Shop (reproducible by modifying the DAG
jaffle_shop_watcher_kubernetesincluded in this PR):ExecutionMode.KUBERNETES: 00:00:32.155ExecutionMode.WATCHER_KUBERNETES: 00:00:11.783Limitations
apache-airflow-providers-cncf-kubernetesprovider (<=10.7.0)deferrable=False.** Pending work**
How to use
ExecutionMode.KUBERNETEScan just replace theexecution_modeto useExecutionMode.WATCHER_KUBERNETES.Example DAG
This PR includes an example DAG that runs with our integration tests,

jaffle_shop_watcher_kubernetes:The producer task runs dbt build using the

KubernetesPodOperator:This task will populate XCom with status updates for each dbt node that is completed.
By default, the consumer tasks will be native Airflow deferrable sensors:

And, in case of retries, the consumer tasks use Cosmos

ExecutionMode.KUBERNETESKPO operators:Closes: #2042