-
Notifications
You must be signed in to change notification settings - Fork 159
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
Kubernetes on warning callback #673
Kubernetes on warning callback #673
Conversation
👷 Deploy Preview for amazing-pothos-a3bca0 processing.
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #673 +/- ##
==========================================
+ Coverage 92.88% 92.93% +0.04%
==========================================
Files 55 55
Lines 2248 2292 +44
==========================================
+ Hits 2088 2130 +42
- Misses 160 162 +2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, @david-mag, this looks very good - it's great to have feature parity to use on_warning_callback
on Kubernetes.
I'm apprehensive about the need for tests. An integration test would be ideal - and we could do that once #535 is completed.
In the meantime, how would you feel about adding some unit tests to the new methods and the class constructor?
…/astronomer-cosmos into kubernetes_on_warning_callback
I've added some unit-tests that (I hope) will cover my additions to the So using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@david-mag thanks for the contribution!
This will improve K8s users experience!
There will be scenarios when OnFinishAction
won't be defined. If the user sets on_warning_callback
and uses ExecutionMode.KUBERNETES
, DbtTestKubernetesOperator
will only work if users use apache-airflow-providers-cncf-kubernetes >= 7.4.0
. I believe this is a fine compromise, considering that before this PR on_warning_callback
wasn't working for any version of the provider when users used ExecutionMode.KUBERNETES
.
Bug fixes * Fix running models that use alias while supporting dbt versions by @binhnq94 in astronomer#662 * Make profiles_yml_path optional for ExecutionMode.DOCKER and KUBERNETES by @MrBones757 in astronomer#681 * Prevent overriding dbt profile fields with profile args of type or method by @jbandoro in astronomer#702 * Fix LoadMode.DBT_LS fail when dbt outputs WarnErrorOptions by @adammarples in astronomer#692 * Add support for env vars in RenderConfig for dbt ls parsing by @jbandoro in astronomer#690 * Add support for Kubernetes on_warning_callback by @david-mag in astronomer#673 * Fix ExecutionConfig.dbt_executable_path to use ``default_factory`` by @jbandoro in astronomer#678 Others * Docs fix: example DAG in the README and docs/index by @tatiana in astronomer#705 * Docs improvement: highlight DAG examples in README by @iancmoritz and @jlaneve in astronomer#695 (cherry picked from commit 2878d6a)
To make `on_warning_callback` work with pod operators, we need to read the logs of the dbt test runs. This is done by ensuring the pod is kept alive, and `on_success_callback` the log is read and analysed for warnings. Afterwards, the pod is cleaned up based on the original settings from the user. If `on_warning_callback` is not set, everything stays the way it always was. This feature only work with `apache-airflow-providers-cncf-kubernetes >= 7.4.0`.
Bug fixes * Fix running models that use alias while supporting dbt versions by @binhnq94 in astronomer#662 * Make profiles_yml_path optional for ExecutionMode.DOCKER and KUBERNETES by @MrBones757 in astronomer#681 * Prevent overriding dbt profile fields with profile args of type or method by @jbandoro in astronomer#702 * Fix LoadMode.DBT_LS fail when dbt outputs WarnErrorOptions by @adammarples in astronomer#692 * Add support for env vars in RenderConfig for dbt ls parsing by @jbandoro in astronomer#690 * Add support for Kubernetes on_warning_callback by @david-mag in astronomer#673 * Fix ExecutionConfig.dbt_executable_path to use ``default_factory`` by @jbandoro in astronomer#678 Others * Docs fix: example DAG in the README and docs/index by @tatiana in astronomer#705 * Docs improvement: highlight DAG examples in README by @iancmoritz and @jlaneve in astronomer#695 (cherry picked from commit 2878d6a)
Description
In order to make
on_warning_callback
work with pod operators, we need to read the logs of the dbt test runs. This is done by making sure the pod is kept alive, andon_success_callback
the log is read and anlayzed for warnings.Afterwards the pod is cleaned up, based on the original settings from the user.
If
on_warning_callback
is not set, everything stays the way it always was.I've tested the changes in my dev environment, but haven't added any new tests, since this would be something (I think) we would need to add integration tests for.
Checklist