Skip to content
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

Fixing ses email backend #18042

Merged
merged 20 commits into from Oct 29, 2021
Merged

Fixing ses email backend #18042

merged 20 commits into from Oct 29, 2021

Conversation

ignaski
Copy link
Contributor

@ignaski ignaski commented Sep 6, 2021

closes: #16166, #17930
related: #16778, #18200


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, 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 UPDATING.md.

@boring-cyborg
Copy link

boring-cyborg bot commented Sep 6, 2021

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (flake8, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

airflow/utils/email.py Outdated Show resolved Hide resolved
@ignaski
Copy link
Contributor Author

ignaski commented Sep 6, 2021

I did some refactoring to bring the repeated code into a single piece of code.
The logic is now that by default send_email will take the sender email and name from configuration. I took the idea from #17930 .In order to keep the previous functionality intact , smtp backend also looks for sender in config smtp section, whereas sendgrid additionaly looks into environment variables.

airflow/providers/sendgrid/utils/emailer.py Outdated Show resolved Hide resolved
airflow/utils/email.py Outdated Show resolved Hide resolved
@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Sep 6, 2021
@github-actions
Copy link

github-actions bot commented Sep 6, 2021

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@ignaski
Copy link
Contributor Author

ignaski commented Sep 10, 2021

@uranusjr there are a few tests failing which seem to be unrelated to the PR changes, shall I be doing anything regarding it?

@uranusjr
Copy link
Member

It seems like the CI failed since it ran out of resource. I think you can disregard those failures.

@uranusjr
Copy link
Member

Also see #18200.

@ecerulm
Copy link
Contributor

ecerulm commented Sep 16, 2021

I would be goog to add a Closes: #17930 to the PR that way it will show on GitHub UI for that issue

@potiuk
Copy link
Member

potiuk commented Sep 16, 2021

I would be goog to add a Closes: #17930 to the PR that way it will show on GitHub UI for that issue

I linked the issue (GitHub allows to link issue also via UI).

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ it. One step closer to getting saner email configuration for various parts of Airflow.

@ignaski
Copy link
Contributor Author

ignaski commented Sep 16, 2021

@potiuk there is some valuable code in #18200, e.g. extension of config template. I plan to improve this PR by incorporating it here.

airflow/utils/email.py Outdated Show resolved Hide resolved
@eladkal eladkal added this to the Airflow 2.3.0 milestone Oct 29, 2021
@eladkal
Copy link
Contributor

eladkal commented Oct 29, 2021

@potiuk should we hold merging this PR as it will cause the Amazon provider to be depended on 2.3.0 ?

@potiuk
Copy link
Member

potiuk commented Oct 29, 2021

I believe the way it's implemented is fuly backwards compatible and I think we do not particularly depend on 2.3.0 (from what I see we just read conf value which fallbacks to None if not set.

But maybe I overlooked something? @uranusjr @eladkal ? can you spot any incompatibilty ?

@uranusjr
Copy link
Member

According to the original issue, the only function this changes in the Amazon provider does not even work right now, so I don't think there's a compatibility issue since there's nothing to be compatible with.

@potiuk potiuk merged commit 1543dc2 into apache:main Oct 29, 2021
@kaxil kaxil modified the milestones: Airflow 2.3.0, Airflow 2.2.4 Dec 21, 2021
jedcunningham pushed a commit that referenced this pull request Jan 21, 2022
(cherry picked from commit 1543dc2)
@jedcunningham jedcunningham added the type:bug-fix Changelog: Bug Fixes label Jan 25, 2022
potiuk added a commit to potiuk/airflow that referenced this pull request Feb 19, 2022
Amazon SES Had a wrong signature to become a mailer in Airflow
introduced in apache#18042. As the result setting SES emailer as
email backend resulted in:

```
TypeError: send_email() missing 1 required positional argument:
'html_content'
```

Fixes: apache#21671
potiuk added a commit that referenced this pull request Feb 19, 2022
Amazon SES Had a wrong signature to become a mailer in Airflow
introduced in #18042. As the result setting SES emailer as
email backend resulted in:

```
TypeError: send_email() missing 1 required positional argument:
'html_content'
```

Fixes: #21671
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers full tests needed We need to run full set of tests for this PR to merge kind:documentation provider:amazon-aws AWS/Amazon - related issues type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emails notifications with AWS SES not working due to missing "from:" field
7 participants