Repository navigation
[AIRFLOW-5477] Rewrite Google PubSub Hook to Google Cloud Python - #6096
Conversation
123eb84 to
e019de8
Compare
e019de8 to
61a8117
Compare
Codecov Report
@@ Coverage Diff @@
## master #6096 +/- ##
==========================================
- Coverage 80.01% 79.45% -0.56%
==========================================
Files 610 610
Lines 35176 35286 +110
==========================================
- Hits 28147 28038 -109
- Misses 7029 7248 +219
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
We should avoid formatting string before passing to logger.
Reference
https://github.com/apache/airflow/pull/4804/files
#5681
There was a problem hiding this comment.
This part of code is not covered by unit test. Can you complete missing unit tests?
There was a problem hiding this comment.
This part of code is not covered by unit test. Can you complete missing unit tests?
There was a problem hiding this comment.
This part of code is not covered by unit test. Can you complete missing unit tests?
|
@mik-laj I've applied changes. Please verify is correct. |
|
@TobKed Today we have had various conversations about this integration. Is this PR done? |
bd5d94a to
abe0842
Compare
abe0842 to
5afb4d0
Compare
|
@mik-laj Yes, hopefully PR is done. I've applied all necessary patches. |
There was a problem hiding this comment.
| template_fields = ['project_id', 'subscription'] | |
| template_fields = ['project', 'project_id', 'subscription'] |
There was a problem hiding this comment.
I had to revert these changes (only "project" shall remain) because of the errors due to errors:
File "/workspace/airflow/models/baseoperator.py", line 662, in _do_render_template_fields content = getattr(parent, attr_name) AttributeError: 'PubSubPublishOperator' object has no attribute 'project'
There was a problem hiding this comment.
Should be OK. Maybe (nice to have) we could add a warning in deprecation message, that templates won't work ?
There was a problem hiding this comment.
| template_fields = ['project_id', 'topic', 'messages'] | |
| template_fields = ['project', 'project_id', 'topic', 'messages'] |
There was a problem hiding this comment.
I had to revert these changes (only
"project"shall remain) because of the errors due to errors:
File "/workspace/airflow/models/baseoperator.py", line 662, in _do_render_template_fields content = getattr(parent, attr_name) AttributeError: 'PubSubPublishOperator' object has no attribute 'project'
|
Can you do rebase? |
2f0dd74 to
c6241b7
Compare
|
Rebased on the last |
c6241b7 to
41f9b95
Compare
|
Everything looks good, but can you do rebase? |
41f9b95 to
a5410d7
Compare
|
I've rebased but due to fact than previous commits impacted PubSub significantly I had to make some changes (remove |
|
I've updated |
There was a problem hiding this comment.
| if self.ack_messages: |
This is a double assertion.
There was a problem hiding this comment.
Good point! Thanks, I've fixed it.
bed237f to
64f7bba
Compare
|
Updated due to comments, slightly improved test, rebased on last master. |
There was a problem hiding this comment.
Just one thing - It seems that the messages should not be base64 encoded when using the client (see example here: https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/pubsub/cloud-client/publisher.py). This means that in all tests, it should be fixed and comments should be updated. Also UPDATING.Md should mention that this should be changed in the input data (or maybe even we should somehow provide backwards compatibility and detect if someone passes a string rather than bytes and decode/encode appropriately).
There was a problem hiding this comment.
Should we leave that TODO here? I think we might already check it here simply to check if we can 'base64' decode What kind of validation we think we miss here? I think we already handle case where "data" is missing. I believe the publish method must check it already if the data is correctly encoded. If so, we should rather remove this TODO. Otherwise we should check ourselves what is the type of "data" field in the loop. I believe
isinstance(data, bytes)
for python 3+ should work fine.
There was a problem hiding this comment.
I think this comment should not be present here.
I have separate PR for message validation waiting in queue:
https://github.com/PolideaInternal/airflow/pull/304/commits
There was a problem hiding this comment.
In the last fixup I've included validation and deprecation warning.
There was a problem hiding this comment.
I think this comment is wrong now. According to https://cloud.google.com/pubsub/docs/publisher (and the code below) the data parameter should be bytestring (utf-8 encoded) rather than base64 encoded string
There was a problem hiding this comment.
You are right. Great point! I've updated docstrings.
There was a problem hiding this comment.
Cool with all those params below. Looks like fully-featured implementation now 👍
There was a problem hiding this comment.
Nice that we keep backwards compatibility.
There was a problem hiding this comment.
Should be OK. Maybe (nice to have) we could add a warning in deprecation message, that templates won't work ?
64f7bba to
b612cb8
Compare
Co-Authored-By: Kamil Breguła <[email protected]>
b612cb8 to
04b9a03
Compare
|
@potiuk I've added message validation. Now when user pass message data as a string which can be base64 decoded, an additional deprecation warning will be displayed, afterwards |
04b9a03 to
9db5c94
Compare
Make sure you have checked all steps below.
Jira
Description
Tests
Commits
Documentation