Uh oh!
There was an error while loading. Please reload this page.
Modify SmtpNotifier to accept template with defaults - #36226
Conversation
cd3a543 to
e54ab78Comparevchiapaikeo
commented
Dec 14, 2023
cc @eladkal , @potiuk , @BasPH, @hussein-awala - would love to hear what you think when you have a moment |
Uh oh!
There was an error while loading. Please reload this page.
hussein-awala
left a comment
There was a problem hiding this comment.
Well done! I just thought about it after seeing your change, and I think doing what @eladkal suggests is not complicated; you can just add a default value for subject and html_content in the SmtpNotifier operator without needing to create a new one, and it will be fully backward compatible.
Uh oh!
There was an error while loading. Please reload this page.
43b56ab to
46ba91aCompare46ba91a to
ed99ba5ComparePlease notice that chicken-egg provider is encountered. apache-airflow-providers-smtp 1.6.0 does not work with airflow 2.8.1 I manually downgraded apache-airflow-providers-smtp to 1.5.0 and it worked fine with airflow 2.8.1 now I was using this constraint file during installation. Should change it to |
potiuk
commented
Feb 26, 2024
This is backward compatibility issue that should be fixed (it was not caught because the settings import was a local import and that's why it passed compatibility checks. Will make a PR fixing it in a moment. |
The apache#36226 introduced backwards compatibility check for the smtp provider, where it relied pn airflow settings containig new settings. This PR fixes it by falling back to default settings in case the settings cannot be imported.
potiuk
commented
Feb 26, 2024
Fix in #37701 |
The #36226 introduced backwards compatibility check for the smtp provider, where it relied pn airflow settings containig new settings. This PR fixes it by falling back to default settings in case the settings cannot be imported.
Related apache#36226 and apache#37701 - where we had problems with SMTP provider 1.6.0.
stephenatgithub
commented
Feb 27, 2024
Wow... really quick responses and immediate actions. Thank you everyone in this airflow community. |
closes: #35381
Creating a TemplatedSmtpNotifier class that simplifies sending emails based on the discussion in #35381. This class simply extends from the SmtpNotifier and defaults a number of the required arguments (like email_from, subject, and html_content). The latter two variables are pulled from airflow/settings.py.
On the template itself, I was initially thinking of having at least three distinct templates following #35381 (comment) but it's simple to add a condition to detect whether we are sending an SLA miss or a failure/success/retry email so I decided on using a single template. Happy to change that approach if the community thinks having distinct templates are cleaner.
Will work on tests after the approach is generally agreed upon.
Examples
Sample dag used to test emails -
on_failure_callback / on_success_callback / on_retry_callback -
sla_miss_callback -
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.