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

feat!: microgenerator changes #203

Merged
merged 35 commits into from Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9e41c07
wip microgenerator changes
kolea2 Oct 27, 2020
8f6f90a
fix unit tests
kolea2 Jan 21, 2021
2239cd0
fix system tests
kolea2 Jan 22, 2021
136a0e8
lint
kolea2 Jan 25, 2021
e52f324
Merge branch 'master' of github.com:kolea2/python-bigtable into micro…
kolea2 Jan 25, 2021
8e9d5c9
fixup after update
kolea2 Jan 25, 2021
ce4a2ea
fix test
kolea2 Jan 25, 2021
ab2d728
regen
kolea2 Feb 1, 2021
c6e75b1
run fixup script
kolea2 Feb 2, 2021
32fa3b2
run fixup script admin
kolea2 Feb 2, 2021
48520c2
add scripts to build
kolea2 Feb 2, 2021
947babb
regenerate
kolea2 Feb 2, 2021
1f9d175
update synth
kolea2 Feb 2, 2021
bf2a7d0
fix tests
kolea2 Feb 2, 2021
293909d
more test cleanup
kolea2 Feb 3, 2021
48f8a10
fix mutate rows
kolea2 Feb 3, 2021
71bef98
Merge branch 'master' of github.com:googleapis/python-bigtable into m…
kolea2 Feb 3, 2021
0a0604a
fix backups test
kolea2 Feb 3, 2021
5e920a2
Merge branch 'master' of github.com:googleapis/python-bigtable into m…
kolea2 Feb 3, 2021
3f34761
fix tests
kolea2 Feb 4, 2021
5469fe2
fix docs and lint
kolea2 Feb 4, 2021
19b1883
fix docs and lint
kolea2 Feb 4, 2021
11f292b
temporarily put coverage at 99
kolea2 Feb 4, 2021
226a760
code feedback
kolea2 Feb 4, 2021
d89876f
Merge branch 'master' of github.com:googleapis/python-bigtable into m…
kolea2 Feb 8, 2021
ad82e4a
move coverage to 99
kolea2 Feb 8, 2021
a5150da
pin beam bigtable deps to 1.0.0
kolea2 Feb 8, 2021
0353c11
pin beam bigtable deps to 1.0.0
kolea2 Feb 8, 2021
90a5d2c
Merge branch 'master' of github.com:googleapis/python-bigtable into m…
kolea2 Feb 10, 2021
d0e40a2
fix imports
kolea2 Feb 10, 2021
51f18f0
fixup keepalive config
kolea2 Feb 10, 2021
9163ec3
lint
kolea2 Feb 10, 2021
b7ef779
cleanup
kolea2 Feb 10, 2021
27f9283
cleanup
kolea2 Feb 11, 2021
92a3fad
cleanup
kolea2 Feb 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 13 additions & 16 deletions google/cloud/bigtable/client.py
Expand Up @@ -35,10 +35,12 @@

from google.cloud import bigtable_v2
from google.cloud import bigtable_admin_v2
from google.cloud.bigtable_v2.gapic.transports import bigtable_grpc_transport
from google.cloud.bigtable_admin_v2.gapic.transports import (
bigtable_table_admin_grpc_transport,
bigtable_instance_admin_grpc_transport,
from google.cloud.bigtable_v2.services.bigtable.transports import BigtableGrpcTransport
from google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.transports import (
BigtableInstanceAdminGrpcTransport,
)
from google.cloud.bigtable_admin_v2.services.bigtable_table_admin.transports import (
BigtableTableAdminGrpcTransport,
)

from google.cloud.bigtable import __version__
Expand Down Expand Up @@ -210,23 +212,19 @@ def _create_gapic_client_channel(self, client_class, grpc_transport):
if self._client_options and self._client_options.api_endpoint:
api_endpoint = self._client_options.api_endpoint
else:
api_endpoint = client_class.SERVICE_ADDRESS
api_endpoint = client_class.DEFAULT_ENDPOINT

channel = grpc_transport.create_channel(
api_endpoint,
self._credentials,
host=api_endpoint,
credentials=self._credentials,
options={
"grpc.max_send_message_length": -1,
"grpc.max_receive_message_length": -1,
"grpc.keepalive_time_ms": 30000,
"grpc.keepalive_timeout_ms": 10000,
}.items(),
)
transport = grpc_transport(
address=api_endpoint,
channel=channel,
credentials=None,
kolea2 marked this conversation as resolved.
Show resolved Hide resolved
)
transport = grpc_transport(channel=channel, host=api_endpoint)
return transport

@property
Expand Down Expand Up @@ -270,8 +268,7 @@ def table_data_client(self):
"""
if self._table_data_client is None:
transport = self._create_gapic_client_channel(
bigtable_v2.BigtableClient,
bigtable_grpc_transport.BigtableGrpcTransport,
bigtable_v2.BigtableClient, BigtableGrpcTransport,
)
klass = _create_gapic_client(
bigtable_v2.BigtableClient,
Expand Down Expand Up @@ -304,7 +301,7 @@ def table_admin_client(self):

transport = self._create_gapic_client_channel(
bigtable_admin_v2.BigtableTableAdminClient,
bigtable_table_admin_grpc_transport.BigtableTableAdminGrpcTransport,
BigtableTableAdminGrpcTransport,
)
klass = _create_gapic_client(
bigtable_admin_v2.BigtableTableAdminClient,
Expand Down Expand Up @@ -337,7 +334,7 @@ def instance_admin_client(self):

transport = self._create_gapic_client_channel(
bigtable_admin_v2.BigtableInstanceAdminClient,
bigtable_instance_admin_grpc_transport.BigtableInstanceAdminGrpcTransport,
BigtableInstanceAdminGrpcTransport,
)
klass = _create_gapic_client(
bigtable_admin_v2.BigtableInstanceAdminClient,
Expand Down
2 changes: 0 additions & 2 deletions google/cloud/bigtable/column_family.py
Expand Up @@ -348,8 +348,6 @@ def _gc_rule_from_pb(gc_rule_pb):
if rule_name == "max_num_versions":
return MaxVersionsGCRule(gc_rule_pb.max_num_versions)
elif rule_name == "max_age":
# todo check this is right
# max_age = _helpers._duration_pb_to_timedelta(gc_rule_pb.max_age)
return MaxAgeGCRule(gc_rule_pb.max_age)
elif rule_name == "union":
return GCRuleUnion([_gc_rule_from_pb(rule) for rule in gc_rule_pb.union.rules])
Expand Down
3 changes: 2 additions & 1 deletion samples/beam/noxfile.py
Expand Up @@ -87,7 +87,8 @@ def get_pytest_env_vars():

TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])

INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False))
# todo(kolea2): temporary workaround to install pinned dep version
INSTALL_LIBRARY_FROM_SOURCE = False
#
# Style Checks
#
Expand Down
2 changes: 1 addition & 1 deletion samples/beam/requirements.txt
@@ -1,3 +1,3 @@
apache-beam==2.27.0
google-cloud-bigtable==1.6.1
google-cloud-bigtable==1.0.0
kolea2 marked this conversation as resolved.
Show resolved Hide resolved
google-cloud-core==1.6.0
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -22,7 +22,7 @@

name = "google-cloud-bigtable"
description = "Google Cloud Bigtable API client library"
version = "1.6.1"
version = "1.7.0"
# Should be one of:
# 'Development Status :: 3 - Alpha'
# 'Development Status :: 4 - Beta'
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_client.py
Expand Up @@ -223,7 +223,6 @@ def test_table_data_client_not_initialized(self):

table_data_client = client.table_data_client
self.assertIsInstance(table_data_client, BigtableClient)
# todo is this expected?
self.assertIs(client._client_info, _CLIENT_INFO)
kolea2 marked this conversation as resolved.
Show resolved Hide resolved
self.assertIs(client._table_data_client, table_data_client)

Expand Down
38 changes: 6 additions & 32 deletions tests/unit/test_table.py
Expand Up @@ -923,22 +923,9 @@ def test_yield_retry_rows(self):
response_iterator = _MockReadRowsIterator(response_2)

# Patch the stub used by the API method.
data_api.table_path.return_value = (
"projects/"
+ self.PROJECT_ID
+ "/instances/"
+ self.INSTANCE_ID
+ "/tables/"
+ self.TABLE_ID
)
table_api.table_path.return_value = (
"projects/"
+ self.PROJECT_ID
+ "/instances/"
+ self.INSTANCE_ID
+ "/tables/"
+ self.TABLE_ID
)
data_api.table_path.return_value = f"projects/{self.PROJECT_ID}/instances/{self.INSTANCE_ID}/tables/{self.TABLE_ID}"
table_api.table_path.return_value = f"projects/{self.PROJECT_ID}/instances/{self.INSTANCE_ID}/tables/{self.TABLE_ID}"

table._instance._client._table_data_client = data_api
table._instance._client._table_admin_client = table_api
client._table_data_client.read_rows.side_effect = [
Expand Down Expand Up @@ -1014,22 +1001,9 @@ def test_yield_rows_with_row_set(self):
response_iterator = _MockReadRowsIterator(response_1, response_2, response_3)

# Patch the stub used by the API method.
data_api.table_path.return_value = (
"projects/"
+ self.PROJECT_ID
+ "/instances/"
+ self.INSTANCE_ID
+ "/tables/"
+ self.TABLE_ID
)
table_api.table_path.return_value = (
"projects/"
+ self.PROJECT_ID
+ "/instances/"
+ self.INSTANCE_ID
+ "/tables/"
+ self.TABLE_ID
)
data_api.table_path.return_value = f"projects/{self.PROJECT_ID}/instances/{self.INSTANCE_ID}/tables/{self.TABLE_ID}"
table_api.table_path.return_value = f"projects/{self.PROJECT_ID}/instances/{self.INSTANCE_ID}/tables/{self.TABLE_ID}"

table._instance._client._table_data_client = data_api
table._instance._client._table_admin_client = table_api
client._table_data_client.read_rows.side_effect = [response_iterator]
Expand Down