You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "vanducng (via GitHub)" <gi...@apache.org> on 2023/04/07 12:21:59 UTC
[GitHub] [airflow] vanducng opened a new pull request, #30524: fix(operators): [smtp] Wrong input params order
vanducng opened a new pull request, #30524:
URL: https://github.com/apache/airflow/pull/30524
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
- The EmailOperator call the smtp_hook.send_email_smtp function with mis-ordered of prams which caused unexpected email subject & content.
Hook function: (subject -> html_content -> from_email)
<img width="465" alt="image" src="https://user-images.githubusercontent.com/2980905/230607722-cfd1a1a0-cb0f-484b-a9e1-a71b92567998.png">
Operator execution call: (from_email -> subject -> html_content)
<img width="544" alt="image" src="https://user-images.githubusercontent.com/2980905/230607807-36617cb6-4622-4c4a-a25d-fd8e54cea794.png">
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
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](https://github.com/apache/airflow/tree/main/newsfragments).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] vanducng commented on pull request #30524: fix(operators): [smtp] Wrong input params order
Posted by "vanducng (via GitHub)" <gi...@apache.org>.
vanducng commented on PR #30524:
URL: https://github.com/apache/airflow/pull/30524#issuecomment-1500247362
@hussein-awala @eladkal I saw this provider was initiated/reviewed in last 3 weeks by you two, kindly help review the fix. Thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] hussein-awala commented on a diff in pull request #30524: fix(operators): [smtp] Wrong input params order
Posted by "hussein-awala (via GitHub)" <gi...@apache.org>.
hussein-awala commented on code in PR #30524:
URL: https://github.com/apache/airflow/pull/30524#discussion_r1160673964
##########
airflow/providers/smtp/operators/smtp.py:
##########
@@ -80,9 +80,9 @@ def execute(self, context: Context):
with SmtpHook(smtp_conn_id=self.conn_id) as smtp_hook:
return smtp_hook.send_email_smtp(
self.to,
- self.from_email,
self.subject,
self.html_content,
+ self.from_email,
Review Comment:
I prefer to provide the name of each argument to avoid the similar problems in the future, wdyt?
```diff
@@ -79,10 +79,10 @@ class EmailOperator(BaseOperator):
def execute(self, context: Context):
with SmtpHook(smtp_conn_id=self.conn_id) as smtp_hook:
return smtp_hook.send_email_smtp(
- self.to,
- self.from_email,
- self.subject,
- self.html_content,
+ to=self.to,
+ subject=self.subject,
+ html_content=self.html_content,
+ from_email=self.from_email,
files=self.files,
cc=self.cc,
bcc=self.bcc,
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] vanducng commented on pull request #30524: `EmailOperator`: fix wrong assignment of `from_email`
Posted by "vanducng (via GitHub)" <gi...@apache.org>.
vanducng commented on PR #30524:
URL: https://github.com/apache/airflow/pull/30524#issuecomment-1500390158
> Let's make the `send_email_smtp` take only keyword arguments to avoid this mistake with any other operator
Can you help to review again?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] boring-cyborg[bot] commented on pull request #30524: `EmailOperator`: fix wrong assignment of `from_email`
Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #30524:
URL: https://github.com/apache/airflow/pull/30524#issuecomment-1500555565
Awesome work, congrats on your first merged pull request!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on pull request #30524: `EmailOperator`: fix wrong assignment of `from_email`
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #30524:
URL: https://github.com/apache/airflow/pull/30524#issuecomment-1500340478
> Let's make the `send_email_smtp` take only keyword arguments to avoid this mistake with any other operator
Agree.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] eladkal commented on pull request #30524: `EmailOperator`: fix wrong assignment of `from_email`
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on PR #30524:
URL: https://github.com/apache/airflow/pull/30524#issuecomment-1500426167
tests are failing :(
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] boring-cyborg[bot] commented on pull request #30524: fix(operators): [smtp] Wrong input params order
Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #30524:
URL: https://github.com/apache/airflow/pull/30524#issuecomment-1500242405
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 (ruff, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) 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](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
- Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/BREEZE.rst) 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](https://www.apache.org/foundation/policies/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]( https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#coding-style-and-best-practices).
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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] eladkal merged pull request #30524: `EmailOperator`: fix wrong assignment of `from_email`
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal merged PR #30524:
URL: https://github.com/apache/airflow/pull/30524
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] vanducng commented on a diff in pull request #30524: fix(operators): [smtp] Wrong input params order
Posted by "vanducng (via GitHub)" <gi...@apache.org>.
vanducng commented on code in PR #30524:
URL: https://github.com/apache/airflow/pull/30524#discussion_r1160682978
##########
airflow/providers/smtp/operators/smtp.py:
##########
@@ -80,9 +80,9 @@ def execute(self, context: Context):
with SmtpHook(smtp_conn_id=self.conn_id) as smtp_hook:
return smtp_hook.send_email_smtp(
self.to,
- self.from_email,
self.subject,
self.html_content,
+ self.from_email,
Review Comment:
Agree, updated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org