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

Google Memcached hooks - improve protobuf messages handling #11743

Merged

Conversation

TobKed
Copy link
Contributor

@TobKed TobKed commented Oct 22, 2020

@boring-cyborg boring-cyborg bot added the provider:google Google (including GCP) related issues label Oct 22, 2020
@TobKed
Copy link
Contributor Author

TobKed commented Oct 22, 2020

PTAL @mik-laj @tanjinP

@@ -572,7 +571,7 @@ def _append_label(instance: cloud_memcache.Instance, key: str, val: str) -> clou
@staticmethod
def proto_message_to_dict(message: proto.Message) -> dict:
"""Helper method to parse protobuf message to dictionary."""
return json.loads(message.__class__.to_json(message))
return message.__class__.to_dict(message)
Copy link
Member

Choose a reason for hiding this comment

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

Can you add comments in the code explaining why?

Copy link
Member

Choose a reason for hiding this comment

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

This code has been deleted. Can you look again?

@@ -572,7 +571,7 @@ def _append_label(instance: cloud_memcache.Instance, key: str, val: str) -> clou
@staticmethod
def proto_message_to_dict(message: proto.Message) -> dict:
"""Helper method to parse protobuf message to dictionary."""
return json.loads(message.__class__.to_json(message))
return message.__class__.to_dict(message)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this method at all? I think we can replace these methods with direct calls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking about it as well. Please check last updates to the PR.

@TobKed TobKed force-pushed the improve-protobuf-in-google-memcached branch from 0fc8add to 7d1eca7 Compare October 23, 2020 11:42
Use to_dict method introduced in proto-plus 1.11.0 instead if operating on json
@TobKed TobKed force-pushed the improve-protobuf-in-google-memcached branch from 7d1eca7 to 6c4d1fe Compare October 23, 2020 12:37
@mik-laj mik-laj merged commit 240c7d4 into apache:master Oct 26, 2020
@mik-laj mik-laj deleted the improve-protobuf-in-google-memcached branch October 26, 2020 11:35
michalmisiewicz pushed a commit to michalmisiewicz/airflow that referenced this pull request Oct 30, 2020
szn pushed a commit to szn/airflow that referenced this pull request Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
provider:google Google (including GCP) related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants