diff options
author | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2017-10-06 09:18:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-06 09:18:36 +0200 |
commit | e01cffc58fd530aa1b9d7ddb1b6d0d0e4624c579 (patch) | |
tree | 276051094c77bd5bb2687e3e3b07ddc2509fa1cc /tools | |
parent | 4bc0b2b6614785ad5064f55f09e1058167fbc55a (diff) | |
parent | ac3d765041e39d235ca82d82230a57a65c9c544e (diff) |
Merge pull request #12839 from jtattermusch/bigquery_upload_retry
Retry when uploading results to bigquery
Diffstat (limited to 'tools')
-rw-r--r-- | tools/run_tests/python_utils/upload_test_results.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/run_tests/python_utils/upload_test_results.py b/tools/run_tests/python_utils/upload_test_results.py index 580e7f7d81..15e827769e 100644 --- a/tools/run_tests/python_utils/upload_test_results.py +++ b/tools/run_tests/python_utils/upload_test_results.py @@ -102,6 +102,15 @@ def upload_results_to_bq(resultset, bq_table, args, platform): test_results['timestamp'] = time.strftime('%Y-%m-%d %H:%M:%S') row = big_query_utils.make_row(str(uuid.uuid4()), test_results) - if not big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET_ID, bq_table, [row]): - print('Error uploading result to bigquery.') - sys.exit(1) + + # TODO(jtattermusch): rows are inserted one by one, very inefficient + max_retries = 3 + for attempt in range(max_retries): + if big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET_ID, bq_table, [row]): + break + else: + if attempt < max_retries - 1: + print('Error uploading result to bigquery, will retry.') + else: + print('Error uploading result to bigquery, all attempts failed.') + sys.exit(1) |