Skip to content

Commit

Permalink
Remove redundant RetryInstanceState and add timeout to futures API .r…
Browse files Browse the repository at this point in the history
…esult calls
  • Loading branch information
tswast committed Aug 10, 2017
1 parent 32ca223 commit 562a261
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions bigquery/tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from test_utils.system import unique_resource_id


JOB_TIMEOUT = 120 # 2 minutes
WHERE = os.path.abspath(os.path.dirname(__file__))


Expand Down Expand Up @@ -381,9 +382,7 @@ def test_load_table_from_local_file_then_dump_table(self):
)

# Retry until done.
job.result()
retry = RetryInstanceState(_job_done, max_tries=8)
retry(job.reload)()
job.result(timeout=JOB_TIMEOUT)

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

Expand Down Expand Up @@ -420,9 +419,7 @@ def test_load_table_from_local_avro_file_then_dump_table(self):
)

# Retry until done.
job.result()
retry = RetryInstanceState(_job_done, max_tries=8)
retry(job.reload)()
job.result(timeout=JOB_TIMEOUT)

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

Expand Down Expand Up @@ -772,9 +769,7 @@ def _load_table_for_dml(self, rows, dataset_name, table_name):
)

# Retry until done.
job.result()
retry = RetryInstanceState(_job_done, max_tries=8)
retry(job.reload)()
job.result(timeout=JOB_TIMEOUT)
self._fetch_single_page(table)

def test_sync_query_w_dml(self):
Expand Down Expand Up @@ -1091,7 +1086,7 @@ def test_async_query_future(self):
str(uuid.uuid4()), 'SELECT 1')
query_job.use_legacy_sql = False

iterator = query_job.result().fetch_data()
iterator = query_job.result(timeout=JOB_TIMEOUT).fetch_data()
rows = list(iterator)
self.assertEqual(rows, [(1,)])

Expand Down

0 comments on commit 562a261

Please sign in to comment.