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

[spanner] fix: set timeout for polling on operations #3488

Merged
merged 5 commits into from
Apr 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions spanner/cloud-client/backup_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def create_backup(instance_id, database_id, backup_id):
operation = backup.create()

# Wait for backup operation to complete.
operation.result()
operation.result(1200)

# Verify that the backup is ready.
backup.reload()
Expand All @@ -68,7 +68,7 @@ def restore_database(instance_id, new_database_id, backup_id):
operation = new_database.restore(backup)

# Wait for restore operation to complete.
operation.result()
operation.result(1200)

# Newly created database has restore information.
new_database.reload()
Expand Down
14 changes: 7 additions & 7 deletions spanner/cloud-client/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def create_database(instance_id, database_id):
operation = database.create()

print('Waiting for operation to complete...')
operation.result()
operation.result(120)

print('Created database {} on instance {}'.format(
database_id, instance_id))
Expand Down Expand Up @@ -213,7 +213,7 @@ def add_index(instance_id, database_id):
'CREATE INDEX AlbumsByAlbumTitle ON Albums(AlbumTitle)'])

print('Waiting for operation to complete...')
operation.result()
operation.result(120)

print('Added the AlbumsByAlbumTitle index.')
# [END spanner_create_index]
Expand Down Expand Up @@ -306,7 +306,7 @@ def add_storing_index(instance_id, database_id):
'STORING (MarketingBudget)'])

print('Waiting for operation to complete...')
operation.result()
operation.result(120)

print('Added the AlbumsByAlbumTitle2 index.')
# [END spanner_create_storing_index]
Expand Down Expand Up @@ -355,7 +355,7 @@ def add_column(instance_id, database_id):
'ALTER TABLE Albums ADD COLUMN MarketingBudget INT64'])

print('Waiting for operation to complete...')
operation.result()
operation.result(120)

print('Added the MarketingBudget column.')
# [END spanner_add_column]
Expand Down Expand Up @@ -509,7 +509,7 @@ def create_table_with_timestamp(instance_id, database_id):
])

print('Waiting for operation to complete...')
operation.result()
operation.result(120)

print('Created Performances table on database {} on instance {}'.format(
database_id, instance_id))
Expand Down Expand Up @@ -554,7 +554,7 @@ def add_timestamp_column(instance_id, database_id):
'OPTIONS(allow_commit_timestamp=true)'])

print('Waiting for operation to complete...')
operation.result()
operation.result(120)

print('Altered table "Albums" on database {} on instance {}.'.format(
database_id, instance_id))
Expand Down Expand Up @@ -1122,7 +1122,7 @@ def create_table_with_datatypes(instance_id, database_id):
])

print('Waiting for operation to complete...')
operation.result()
operation.result(120)

print('Created Venues table on database {} on instance {}'.format(
database_id, instance_id))
Expand Down