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

Update Protobuf and GCP dependencies in Beam Python SDK #24599

Merged
merged 79 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
a3e72b7
Update build dependencies and mypy-protobuf
AnandInguva Dec 8, 2022
673aaf3
Update import
AnandInguva Dec 28, 2022
ee1da36
Add os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'python'
AnandInguva Feb 14, 2023
6140ff7
Update gen_protos.py
AnandInguva Feb 16, 2023
8f24747
Manually generate proto file.
AnandInguva Feb 16, 2023
e6af718
update proto file
AnandInguva Feb 17, 2023
9c44141
Remove redundant code
AnandInguva Feb 17, 2023
5860711
Add encoding
AnandInguva Feb 17, 2023
fd4176f
Update protobuf
AnandInguva Feb 17, 2023
2cf5526
Remove tensorflow ad google cloud profiler
AnandInguva Feb 17, 2023
afbe42d
update dependencies
AnandInguva Feb 17, 2023
ab20544
update facets-overview
AnandInguva Feb 18, 2023
990cf94
Update goolge-cloud-langugage code to support breaking changes from v2.0
AnandInguva Feb 19, 2023
7eab925
Update video intelligence breaking changes
AnandInguva Feb 19, 2023
073788d
Update lower bounds on some gcp deps
AnandInguva Feb 19, 2023
15a4d3b
Merge remote-tracking branch 'upstream/master' into update-protobuf
AnandInguva Feb 19, 2023
30b9b7f
Update deps
AnandInguva Feb 19, 2023
882e5af
Debug
AnandInguva Feb 21, 2023
bf2846c
Update gen_protos.py to supoort google._upb
AnandInguva Feb 21, 2023
3a0c1b7
Change checking condition to cpp to upb
AnandInguva Feb 21, 2023
2614d0e
Update google-cloud-datastore ByteSize
AnandInguva Feb 21, 2023
188a5d6
Update Dockerfile
AnandInguva Feb 21, 2023
2dba13f
raise Error
AnandInguva Feb 22, 2023
b5ac388
Update dependencies bound
AnandInguva Feb 22, 2023
0045b89
Merge remote-tracking branch 'origin/update-protobuf' into update-pro…
AnandInguva Feb 22, 2023
9b2f0de
Merge remote-tracking branch 'upstream/master' into update-protobuf
AnandInguva Feb 22, 2023
35631f5
Add optional field
AnandInguva Feb 22, 2023
1d93010
Add license headers
AnandInguva Feb 22, 2023
3801c16
Add more optional
AnandInguva Feb 22, 2023
8d25563
Changes types to make them compatible with mypy-protobuf generated stubs
AnandInguva Feb 22, 2023
3e95526
Merge remote-tracking branch 'origin/update-protobuf' into update-pro…
AnandInguva Feb 22, 2023
de15ba2
Add license for grpcio-status
AnandInguva Feb 23, 2023
eac41bb
Merge remote-tracking branch 'upstream/master' into update-protobuf
AnandInguva Feb 23, 2023
853fc86
update mypy to 0.790
AnandInguva Feb 23, 2023
1ebc815
add more optional fields to satisfy mypy type checker
AnandInguva Feb 23, 2023
7bfece4
Identify and solve the mypy type checks
AnandInguva Feb 23, 2023
7552e3d
fix lint
AnandInguva Feb 23, 2023
01d7898
Revert "add more optional fields to satisfy mypy type checker"
AnandInguva Feb 23, 2023
15f47d8
Revert "Add more optional"
AnandInguva Feb 22, 2023
cb23020
Revert "Add optional field"
AnandInguva Feb 22, 2023
7b4d9f5
add relax_strict_optional_primitives to mypy_out
AnandInguva Feb 24, 2023
caa04aa
Merge pull request #105 from AnandInguva/update-protobuf-testing
AnandInguva Feb 24, 2023
bf78ba6
Fix up formatting
AnandInguva Feb 24, 2023
b7a1807
Fix up lint
AnandInguva Feb 24, 2023
cb8d016
Fix up formatting
AnandInguva Feb 24, 2023
650827f
Fix up lint
AnandInguva Feb 24, 2023
f522b38
fix lint
AnandInguva Feb 24, 2023
7c4d268
Fix up docs
AnandInguva Feb 24, 2023
297b7f4
Add gh issue to update code and doc strings
AnandInguva Feb 24, 2023
83c4477
Update lower bound of gcp dependencies
AnandInguva Feb 24, 2023
e7844e6
Merge branch 'update-protobuf' into update-protobuf-testing
AnandInguva Feb 24, 2023
7eee7b7
Merge remote-tracking branch 'upstream/master' into update-protobuf-t…
AnandInguva Feb 24, 2023
adf34fb
Add tensorflow rc
AnandInguva Mar 7, 2023
adb7d30
Add tf rc version and comment onnx tests
AnandInguva Mar 8, 2023
0070723
Update container dependencies
AnandInguva Mar 8, 2023
c542de5
comment onnx task
AnandInguva Mar 8, 2023
8deb83c
Merge branch 'update-protobuf' into update-protobuf-testing
AnandInguva Mar 8, 2023
345f780
Merge remote-tracking branch 'upstream/master' into update-protobuf-t…
AnandInguva Mar 8, 2023
2f94ddd
Change bound on google-cloud-recommendations
AnandInguva Mar 10, 2023
5bafc65
Modify FakeMutation to support mocking proto messages
AnandInguva Mar 10, 2023
dd6dbec
Update comment
AnandInguva Mar 10, 2023
bc58086
Add todo for uncommenting onnx changes
AnandInguva Mar 10, 2023
e35bdef
update comment
AnandInguva Mar 10, 2023
84aeff4
Merge remote-tracking branch 'upstream/master' into update-protobuf-t…
AnandInguva Mar 10, 2023
b617f60
Update dependencies
AnandInguva Mar 10, 2023
2ce87e7
Merge branch 'update-protobuf-testing' into update-protobuf
AnandInguva Mar 10, 2023
334846a
revert doc change
AnandInguva Mar 10, 2023
9456a33
Merge branch 'update-protobuf-testing' into update-protobuf
AnandInguva Mar 10, 2023
15db416
Refactor code/remove helper function from util
AnandInguva Mar 10, 2023
2558b6b
Update comment
AnandInguva Mar 10, 2023
454481e
Uncomment changes
AnandInguva Mar 10, 2023
af2de21
Update tensorflow
AnandInguva Mar 10, 2023
6893398
Comment tfx-bsl tests
AnandInguva Mar 10, 2023
f72eaa3
Update tox.ini syntax
AnandInguva Mar 10, 2023
a29505f
refactor
AnandInguva Mar 10, 2023
ba8b376
fix requirements
AnandInguva Mar 12, 2023
5534073
Skip tensorflow tests on Python 3.7
AnandInguva Mar 13, 2023
a678bc4
Merge remote-tracking branch 'upstream/master' into update-protobuf
AnandInguva Mar 13, 2023
0f0c3ec
Merge remote-tracking branch 'upstream/master' into update-protobuf
AnandInguva Mar 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
319 changes: 27 additions & 292 deletions sdks/python/apache_beam/coders/proto2_coder_test_messages_pb2.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: apache_beam/coders/proto2_coder_test_messages.proto

"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)

Expand All @@ -30,293 +30,28 @@



DESCRIPTOR = _descriptor.FileDescriptor(
name='apache_beam/coders/proto2_coder_test_messages.proto',
package='proto2_coder_test_messages',
syntax='proto2',
serialized_options=b'\n\'org.apache.beam.sdk.extensions.protobuf',
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n3apache_beam/coders/proto2_coder_test_messages.proto\x12\x1aproto2_coder_test_messages\"P\n\x08MessageA\x12\x0e\n\x06\x66ield1\x18\x01 \x01(\t\x12\x34\n\x06\x66ield2\x18\x02 \x03(\x0b\x32$.proto2_coder_test_messages.MessageB\"\x1a\n\x08MessageB\x12\x0e\n\x06\x66ield1\x18\x01 \x01(\x08\"\x10\n\x08MessageC*\x04\x08\x64\x10j\"\xad\x01\n\x0eMessageWithMap\x12\x46\n\x06\x66ield1\x18\x01 \x03(\x0b\x32\x36.proto2_coder_test_messages.MessageWithMap.Field1Entry\x1aS\n\x0b\x46ield1Entry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x33\n\x05value\x18\x02 \x01(\x0b\x32$.proto2_coder_test_messages.MessageA:\x02\x38\x01\"V\n\x18ReferencesMessageWithMap\x12:\n\x06\x66ield1\x18\x01 \x03(\x0b\x32*.proto2_coder_test_messages.MessageWithMap:Z\n\x06\x66ield1\x12$.proto2_coder_test_messages.MessageC\x18\x65 \x01(\x0b\x32$.proto2_coder_test_messages.MessageA:Z\n\x06\x66ield2\x12$.proto2_coder_test_messages.MessageC\x18\x66 \x01(\x0b\x32$.proto2_coder_test_messages.MessageBB)\n\'org.apache.beam.sdk.extensions.protobuf'
)


FIELD1_FIELD_NUMBER = 101
field1 = _descriptor.FieldDescriptor(
name='field1', full_name='proto2_coder_test_messages.field1', index=0,
number=101, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=True, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)
FIELD2_FIELD_NUMBER = 102
field2 = _descriptor.FieldDescriptor(
name='field2', full_name='proto2_coder_test_messages.field2', index=1,
number=102, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=True, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)


_MESSAGEA = _descriptor.Descriptor(
name='MessageA',
full_name='proto2_coder_test_messages.MessageA',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='field1', full_name='proto2_coder_test_messages.MessageA.field1', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='field2', full_name='proto2_coder_test_messages.MessageA.field2', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=83,
serialized_end=163,
)


_MESSAGEB = _descriptor.Descriptor(
name='MessageB',
full_name='proto2_coder_test_messages.MessageB',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='field1', full_name='proto2_coder_test_messages.MessageB.field1', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=165,
serialized_end=191,
)


_MESSAGEC = _descriptor.Descriptor(
name='MessageC',
full_name='proto2_coder_test_messages.MessageC',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=True,
syntax='proto2',
extension_ranges=[(100, 106), ],
oneofs=[
],
serialized_start=193,
serialized_end=209,
)


_MESSAGEWITHMAP_FIELD1ENTRY = _descriptor.Descriptor(
name='Field1Entry',
full_name='proto2_coder_test_messages.MessageWithMap.Field1Entry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='proto2_coder_test_messages.MessageWithMap.Field1Entry.key', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='value', full_name='proto2_coder_test_messages.MessageWithMap.Field1Entry.value', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=b'8\001',
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=302,
serialized_end=385,
)

_MESSAGEWITHMAP = _descriptor.Descriptor(
name='MessageWithMap',
full_name='proto2_coder_test_messages.MessageWithMap',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='field1', full_name='proto2_coder_test_messages.MessageWithMap.field1', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[_MESSAGEWITHMAP_FIELD1ENTRY, ],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=212,
serialized_end=385,
)


_REFERENCESMESSAGEWITHMAP = _descriptor.Descriptor(
name='ReferencesMessageWithMap',
full_name='proto2_coder_test_messages.ReferencesMessageWithMap',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='field1', full_name='proto2_coder_test_messages.ReferencesMessageWithMap.field1', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=387,
serialized_end=473,
)

_MESSAGEA.fields_by_name['field2'].message_type = _MESSAGEB
_MESSAGEWITHMAP_FIELD1ENTRY.fields_by_name['value'].message_type = _MESSAGEA
_MESSAGEWITHMAP_FIELD1ENTRY.containing_type = _MESSAGEWITHMAP
_MESSAGEWITHMAP.fields_by_name['field1'].message_type = _MESSAGEWITHMAP_FIELD1ENTRY
_REFERENCESMESSAGEWITHMAP.fields_by_name['field1'].message_type = _MESSAGEWITHMAP
DESCRIPTOR.message_types_by_name['MessageA'] = _MESSAGEA
DESCRIPTOR.message_types_by_name['MessageB'] = _MESSAGEB
DESCRIPTOR.message_types_by_name['MessageC'] = _MESSAGEC
DESCRIPTOR.message_types_by_name['MessageWithMap'] = _MESSAGEWITHMAP
DESCRIPTOR.message_types_by_name['ReferencesMessageWithMap'] = _REFERENCESMESSAGEWITHMAP
DESCRIPTOR.extensions_by_name['field1'] = field1
DESCRIPTOR.extensions_by_name['field2'] = field2
_sym_db.RegisterFileDescriptor(DESCRIPTOR)

MessageA = _reflection.GeneratedProtocolMessageType('MessageA', (_message.Message,), {
'DESCRIPTOR' : _MESSAGEA,
'__module__' : 'apache_beam.coders.proto2_coder_test_messages_pb2'
# @@protoc_insertion_point(class_scope:proto2_coder_test_messages.MessageA)
})
_sym_db.RegisterMessage(MessageA)

MessageB = _reflection.GeneratedProtocolMessageType('MessageB', (_message.Message,), {
'DESCRIPTOR' : _MESSAGEB,
'__module__' : 'apache_beam.coders.proto2_coder_test_messages_pb2'
# @@protoc_insertion_point(class_scope:proto2_coder_test_messages.MessageB)
})
_sym_db.RegisterMessage(MessageB)

MessageC = _reflection.GeneratedProtocolMessageType('MessageC', (_message.Message,), {
'DESCRIPTOR' : _MESSAGEC,
'__module__' : 'apache_beam.coders.proto2_coder_test_messages_pb2'
# @@protoc_insertion_point(class_scope:proto2_coder_test_messages.MessageC)
})
_sym_db.RegisterMessage(MessageC)

MessageWithMap = _reflection.GeneratedProtocolMessageType('MessageWithMap', (_message.Message,), {

'Field1Entry' : _reflection.GeneratedProtocolMessageType('Field1Entry', (_message.Message,), {
'DESCRIPTOR' : _MESSAGEWITHMAP_FIELD1ENTRY,
'__module__' : 'apache_beam.coders.proto2_coder_test_messages_pb2'
# @@protoc_insertion_point(class_scope:proto2_coder_test_messages.MessageWithMap.Field1Entry)
})
,
'DESCRIPTOR' : _MESSAGEWITHMAP,
'__module__' : 'apache_beam.coders.proto2_coder_test_messages_pb2'
# @@protoc_insertion_point(class_scope:proto2_coder_test_messages.MessageWithMap)
})
_sym_db.RegisterMessage(MessageWithMap)
_sym_db.RegisterMessage(MessageWithMap.Field1Entry)

ReferencesMessageWithMap = _reflection.GeneratedProtocolMessageType('ReferencesMessageWithMap', (_message.Message,), {
'DESCRIPTOR' : _REFERENCESMESSAGEWITHMAP,
'__module__' : 'apache_beam.coders.proto2_coder_test_messages_pb2'
# @@protoc_insertion_point(class_scope:proto2_coder_test_messages.ReferencesMessageWithMap)
})
_sym_db.RegisterMessage(ReferencesMessageWithMap)

field1.message_type = _MESSAGEA
MessageC.RegisterExtension(field1)
field2.message_type = _MESSAGEB
MessageC.RegisterExtension(field2)

DESCRIPTOR._options = None
_MESSAGEWITHMAP_FIELD1ENTRY._options = None
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n3apache_beam/coders/proto2_coder_test_messages.proto\x12\x1aproto2_coder_test_messages\"P\n\x08MessageA\x12\x0e\n\x06\x66ield1\x18\x01 \x01(\t\x12\x34\n\x06\x66ield2\x18\x02 \x03(\x0b\x32$.proto2_coder_test_messages.MessageB\"\x1a\n\x08MessageB\x12\x0e\n\x06\x66ield1\x18\x01 \x01(\x08\"\x10\n\x08MessageC*\x04\x08\x64\x10j\"\xad\x01\n\x0eMessageWithMap\x12\x46\n\x06\x66ield1\x18\x01 \x03(\x0b\x32\x36.proto2_coder_test_messages.MessageWithMap.Field1Entry\x1aS\n\x0b\x46ield1Entry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x33\n\x05value\x18\x02 \x01(\x0b\x32$.proto2_coder_test_messages.MessageA:\x02\x38\x01\"V\n\x18ReferencesMessageWithMap\x12:\n\x06\x66ield1\x18\x01 \x03(\x0b\x32*.proto2_coder_test_messages.MessageWithMap:Z\n\x06\x66ield1\x12$.proto2_coder_test_messages.MessageC\x18\x65 \x01(\x0b\x32$.proto2_coder_test_messages.MessageA:Z\n\x06\x66ield2\x12$.proto2_coder_test_messages.MessageC\x18\x66 \x01(\x0b\x32$.proto2_coder_test_messages.MessageBB)\n\'org.apache.beam.sdk.extensions.protobuf')

_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'apache_beam.coders.proto2_coder_test_messages_pb2', globals())
if _descriptor._USE_C_DESCRIPTORS == False:
MessageC.RegisterExtension(field1)
MessageC.RegisterExtension(field2)

DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'\n\'org.apache.beam.sdk.extensions.protobuf'
_MESSAGEWITHMAP_FIELD1ENTRY._options = None
_MESSAGEWITHMAP_FIELD1ENTRY._serialized_options = b'8\001'
_MESSAGEA._serialized_start=83
_MESSAGEA._serialized_end=163
_MESSAGEB._serialized_start=165
_MESSAGEB._serialized_end=191
_MESSAGEC._serialized_start=193
_MESSAGEC._serialized_end=209
_MESSAGEWITHMAP._serialized_start=212
_MESSAGEWITHMAP._serialized_end=385
_MESSAGEWITHMAP_FIELD1ENTRY._serialized_start=302
_MESSAGEWITHMAP_FIELD1ENTRY._serialized_end=385
_REFERENCESMESSAGEWITHMAP._serialized_start=387
_REFERENCESMESSAGEWITHMAP._serialized_end=473
# @@protoc_insertion_point(module_scope)
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def process(self, element):
client_element = self.element_to_client_batch_item(element)
self._batch_elements.append(client_element)
self.add_to_batch(client_element)
self._batch_bytes_size += self._batch.mutations[-1].ByteSize()
self._batch_bytes_size += self._batch.mutations[-1]._pb.ByteSize()

if (len(self._batch.mutations) >= self._target_batch_size or
self._batch_bytes_size > util.WRITE_BATCH_MAX_BYTES_SIZE):
Expand Down
21 changes: 15 additions & 6 deletions sdks/python/apache_beam/io/gcp/datastore/v1new/datastoreio_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@
client = None


# used for internal testing only
class FakeMessage:
def __init__(self, entity, key):
self.entity = entity
self.key = key

def ByteSize(self):
if self.entity is not None:
return helpers.entity_to_protobuf(self.entity)._pb.ByteSize()
else:
return self.key.to_protobuf()._pb.ByteSize()


# used for internal testing only
class FakeMutation(object):
def __init__(self, entity=None, key=None):
"""Fake mutation request object.
Expand All @@ -63,12 +77,7 @@ def __init__(self, entity=None, key=None):
"""
self.entity = entity
self.key = key

def ByteSize(self):
if self.entity is not None:
return helpers.entity_to_protobuf(self.entity).ByteSize()
else:
return self.key.to_protobuf().ByteSize()
self._pb = FakeMessage(entity, key)


class FakeBatch(object):
Expand Down
9 changes: 9 additions & 0 deletions sdks/python/apache_beam/ml/gcp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# TODO(https://github.com/apache/beam/issues/25625)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't follow these comments.

Copy link
Contributor Author

@AnandInguva AnandInguva Mar 10, 2023

Choose a reason for hiding this comment

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

Added some context.

Copy link
Contributor

Choose a reason for hiding this comment

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

this comment looks out of place here. let's keep the file as is and use the issue you filed for tracking purposes and further discussion.


# update code. For example,
# use class something(beam.PTransform) instead of decorator @beam.ptransform_fn
# on a function.

# update type annotations to follow pep 484 https://peps.python.org/pep-0484/
# and also update doc strings.
Loading