FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Remove redundant RetryInstanceState and add timeout to futures API .r… · googleapis/google-cloud-python@562a261 · GitHub

Commit 562a261

Browse files
committed
Remove redundant RetryInstanceState and add timeout to futures API .result calls
1 parent 32ca223 commit 562a261

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

‎bigquery/tests/system.py‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from test_utils.system import unique_resource_id
3636

3737

38+
JOB_TIMEOUT = 120 # 2 minutes
3839
WHERE = os.path.abspath(os.path.dirname(__file__))
3940

4041

@@ -381,9 +382,7 @@ def test_load_table_from_local_file_then_dump_table(self):
381382
)
382383

383384
# Retry until done.
384-
job.result()
385-
retry = RetryInstanceState(_job_done, max_tries=8)
386-
retry(job.reload)()
385+
job.result(timeout=JOB_TIMEOUT)
387386

388387
self.assertEqual(job.output_rows, len(ROWS))
389388

@@ -420,9 +419,7 @@ def test_load_table_from_local_avro_file_then_dump_table(self):
420419
)
421420

422421
# Retry until done.
423-
job.result()
424-
retry = RetryInstanceState(_job_done, max_tries=8)
425-
retry(job.reload)()
422+
job.result(timeout=JOB_TIMEOUT)
426423

427424
self.assertEqual(job.output_rows, len(ROWS))
428425

@@ -772,9 +769,7 @@ def _load_table_for_dml(self, rows, dataset_name, table_name):
772769
)
773770

774771
# Retry until done.
775-
job.result()
776-
retry = RetryInstanceState(_job_done, max_tries=8)
777-
retry(job.reload)()
772+
job.result(timeout=JOB_TIMEOUT)
778773
self._fetch_single_page(table)
779774

780775
def test_sync_query_w_dml(self):
@@ -1091,7 +1086,7 @@ def test_async_query_future(self):
10911086
str(uuid.uuid4()), 'SELECT 1')
10921087
query_job.use_legacy_sql = False
10931088

1094-
iterator = query_job.result().fetch_data()
1089+
iterator = query_job.result(timeout=JOB_TIMEOUT).fetch_data()
10951090
rows = list(iterator)
10961091
self.assertEqual(rows, [(1,)])
10971092

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL