You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/12/19 19:05:18 UTC
[GitHub] [airflow] DreamPearl opened a new pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
DreamPearl opened a new pull request #13187:
URL: https://github.com/apache/airflow/pull/13187
Adding the gzip ability to the hook and then the mongo_to_S3 using it
from the hook.
<!--
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 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/
-->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+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 [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] boring-cyborg[bot] commented on pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#issuecomment-748512576
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/master/CONTRIBUTING.rst)
Here are some useful points:
- Pay attention to the quality of your code (flake8, pylint and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/master/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/master/docs/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/master/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/master/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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] DreamPearl commented on a change in pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
DreamPearl commented on a change in pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#discussion_r551524557
##########
File path: airflow/providers/amazon/aws/hooks/s3.py
##########
@@ -539,11 +540,24 @@ def load_string(
:param acl_policy: The string to specify the canned ACL policy for the
object to be uploaded
:type acl_policy: str
+ :param compression: Type of compression to use, currently only gzip is supported.
+ :type compression: str
"""
encoding = encoding or 'utf-8'
bytes_data = string_data.encode(encoding)
+
+ # Compress string
+ if compression not in (None, 'gzip'):
+ raise NotImplementedError(
+ "Received {} compression type. String "
+ "can currently be compressed in gzip only.".format(compression)
+ )
Review comment:
Thanks for the suggestion, I've updated the PR. And also added one more test to check the exception raised. Can you please take a look 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] DreamPearl commented on pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
DreamPearl commented on pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#issuecomment-751377409
@feluelle @mik-laj Can you please take a look and guide me further?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] DreamPearl commented on a change in pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
DreamPearl commented on a change in pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#discussion_r546408675
##########
File path: airflow/providers/amazon/aws/hooks/s3.py
##########
@@ -515,6 +515,7 @@ def load_string(
encrypt: bool = False,
encoding: Optional[str] = None,
acl_policy: Optional[str] = None,
+ gzip: bool = False,
Review comment:
Thanks for the direction.
Updated the pull request. Can you please take a look 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] feluelle commented on a change in pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
feluelle commented on a change in pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#discussion_r551194141
##########
File path: airflow/providers/amazon/aws/hooks/s3.py
##########
@@ -515,6 +515,7 @@ def load_string(
encrypt: bool = False,
encoding: Optional[str] = None,
acl_policy: Optional[str] = None,
+ gzip: bool = False,
Review comment:
SGTM - using `compression` instead of `gzip`. π
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] feluelle merged pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
feluelle merged pull request #13187:
URL: https://github.com/apache/airflow/pull/13187
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] DreamPearl commented on a change in pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
DreamPearl commented on a change in pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#discussion_r546352146
##########
File path: airflow/providers/amazon/aws/hooks/s3.py
##########
@@ -515,6 +515,7 @@ def load_string(
encrypt: bool = False,
encoding: Optional[str] = None,
acl_policy: Optional[str] = None,
+ gzip: bool = False,
Review comment:
As it is mentioned in the issue [AIRFLOW-3723](https://issues.apache.org/jira/browse/AIRFLOW-3723) to use gzip. As well as I noticed that most of the people in nearby code are using gzip so to maintain consistency I used gzip.
- https://github.com/apache/airflow/blob/master/airflow/providers/amazon/aws/hooks/s3.py#L495-L500
- https://github.com/apache/airflow/search?q=gzip
If you think changing the function parameter from `gzip` to `zip` would be better here in the same PR I will be happy to change it. Please let me know if you have more suggestions.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] feluelle commented on a change in pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
feluelle commented on a change in pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#discussion_r551193283
##########
File path: airflow/providers/amazon/aws/hooks/s3.py
##########
@@ -539,11 +540,24 @@ def load_string(
:param acl_policy: The string to specify the canned ACL policy for the
object to be uploaded
:type acl_policy: str
+ :param compression: Type of compression to use, currently only gzip is supported.
+ :type compression: str
"""
encoding = encoding or 'utf-8'
bytes_data = string_data.encode(encoding)
+
+ # Compress string
+ if compression not in (None, 'gzip'):
+ raise NotImplementedError(
+ "Received {} compression type. String "
+ "can currently be compressed in gzip only.".format(compression)
+ )
Review comment:
Maybe we could automatically create the error message based on available compressions if we store these in a variable and read from it.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ad-m commented on pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
ad-m commented on pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#issuecomment-755933599
> > @DreamPearl please rebase onto latest master. There was an issue a few days ago which is now fixed.
>
> @feluelle Done!
Thank you π
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ad-m commented on a change in pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
ad-m commented on a change in pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#discussion_r546363526
##########
File path: airflow/providers/amazon/aws/hooks/s3.py
##########
@@ -515,6 +515,7 @@ def load_string(
encrypt: bool = False,
encoding: Optional[str] = None,
acl_policy: Optional[str] = None,
+ gzip: bool = False,
Review comment:
I am not questioning the choice of the gzip algorithm for now. It is now standard and popular. I wonder if adding the "gzip" parameter instead of - for example - "compression" (enum with value "gzip") will not make this operator have many parameters in the future when more algorithm might be added. See for example at https://github.com/apache/airflow/blob/349b0811c3022605426ba57d30936240a7c2848a/airflow/providers/google/cloud/transfers/bigquery_to_gcs.py#L47-L48 regarding future-proof `compression` parameter.
I would like to point out that your experience with Airflow is definitely much greater than mine. I mainly observe and comment on the project from time to time.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] github-actions[bot] commented on pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#issuecomment-754205475
[The Workflow run](https://github.com/apache/airflow/actions/runs/461877420) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] DreamPearl commented on pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
DreamPearl commented on pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#issuecomment-755929401
> @DreamPearl please rebase onto latest master. There was an issue a few days ago which is now fixed.
@feluelle Done!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] feluelle commented on pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
feluelle commented on pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#issuecomment-755444686
@DreamPearl please rebase onto latest master. There was an issue a few days ago which is now fixed.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ad-m commented on a change in pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
ad-m commented on a change in pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#discussion_r546315768
##########
File path: airflow/providers/amazon/aws/hooks/s3.py
##########
@@ -515,6 +515,7 @@ def load_string(
encrypt: bool = False,
encoding: Optional[str] = None,
acl_policy: Optional[str] = None,
+ gzip: bool = False,
Review comment:
Why only gzip? zstd is also gaining more and more popularity and other algorithms may be developed in the future. Have you considered approaching the interface in a general way but implement one algorithm for now?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ad-m commented on a change in pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
ad-m commented on a change in pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#discussion_r546363526
##########
File path: airflow/providers/amazon/aws/hooks/s3.py
##########
@@ -515,6 +515,7 @@ def load_string(
encrypt: bool = False,
encoding: Optional[str] = None,
acl_policy: Optional[str] = None,
+ gzip: bool = False,
Review comment:
I am not questioning the choice of the gzip algorithm. It is now standard and popular. I wonder if adding the "gzip" parameter instead of - for example - "compression" (enum with value "gzip") will not make this operator have many parameters in the future when more algorithm might be added. See for example at https://github.com/apache/airflow/blob/349b0811c3022605426ba57d30936240a7c2848a/airflow/providers/google/cloud/transfers/bigquery_to_gcs.py#L47-L48 regarding future-proof `compression` parameter.
I would like to point out that your experience with Airflow is definitely much greater than mine. I mainly observe and comment on the project from time to time.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] github-actions[bot] commented on pull request #13187: [AIRFLOW-3723] Add Gzip capability to mongo_to_S3 operator
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #13187:
URL: https://github.com/apache/airflow/pull/13187#issuecomment-753902670
The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest master or amend the last commit of the PR, and push it with --force-with-lease.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org