Skip to content

Commit

Permalink
fix: use exception clases to DRY RETRY_CODES
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Sep 21, 2020
1 parent 6f08cef commit 27b4825
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions google/cloud/bigtable/table.py
Expand Up @@ -14,8 +14,6 @@

"""User-friendly container for Google Cloud Bigtable Table."""

from grpc import StatusCode

from google.api_core import timeout
from google.api_core.exceptions import Aborted
from google.api_core.exceptions import DeadlineExceeded
Expand Down Expand Up @@ -989,15 +987,12 @@ class _RetryableMutateRowsWorker(object):
are retryable, any subsequent call on this callable will be a no-op.
"""

# pylint: disable=unsubscriptable-object
RETRY_CODES = (
StatusCode.DEADLINE_EXCEEDED.value[0],
StatusCode.ABORTED.value[0],
StatusCode.UNAVAILABLE.value[0],
Aborted.grpc_status_code.value[0],
DeadlineExceeded.grpc_status_code.value[0],
ServiceUnavailable.grpc_status_code.value[0],
)

# pylint: enable=unsubscriptable-object

def __init__(self, client, table_name, rows, app_profile_id=None, timeout=None):
self.client = client
self.table_name = table_name
Expand Down

0 comments on commit 27b4825

Please sign in to comment.