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
Modify SmtpNotifier to accept template with defaults #36226
Conversation
cd3a543
to
e54ab78
Compare
cc @eladkal , @potiuk , @BasPH, @hussein-awala - would love to hear what you think when you have a moment |
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.
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.
43b56ab
to
46ba91a
Compare
46ba91a
to
ed99ba5
Compare
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.
LGTM. @hussein-awala @eladkal ?
Please 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 |
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.
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.
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.
Related apache#36226 and apache#37701 - where we had problems with SMTP provider 1.6.0.
Related apache#36226 and apache#37701 - where we had problems with SMTP provider 1.6.0.
Wow... really quick responses and immediate actions. Thank you everyone in this airflow community. |
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.
…#37713) Related apache#36226 and apache#37701 - where we had problems with SMTP provider 1.6.0.
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.
…#37713) Related apache#36226 and apache#37701 - where we had problems with SMTP provider 1.6.0.
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.rst
or{issue_number}.significant.rst
, in newsfragments.