File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
packages/google-cloud-bigtable/docs Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -395,6 +395,8 @@ def test_bigtable_update_cluster():
395395
396396def test_bigtable_create_table ():
397397 # [START bigtable_create_table]
398+ from google .api_core import exceptions
399+ from google .api_core import retry
398400 from google .cloud .bigtable import Client
399401 from google .cloud .bigtable import column_family
400402
@@ -403,7 +405,13 @@ def test_bigtable_create_table():
403405 table = instance .table ("table_my" )
404406 # Define the GC policy to retain only the most recent 2 versions.
405407 max_versions_rule = column_family .MaxVersionsGCRule (2 )
406- table .create (column_families = {"cf1" : max_versions_rule })
408+
409+ # Could include other retriable exception types
410+ # Could configure deadline, etc.
411+ predicate_504 = retry .if_exception_type (exceptions .DeadlineExceeded )
412+ retry_504 = retry .Retry (predicate_504 )
413+
414+ retry_504 (table .create )(column_families = {"cf1" : max_versions_rule })
407415 # [END bigtable_create_table]
408416
409417 try :
You can’t perform that action at this time.
0 commit comments