Improve dashboard upload script so the errors are more understandable

No-Presubmit: True
Bug: None
Change-Id: I2bc297fddacd33037a7c77107d653da87dd2737e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195560
Commit-Queue: Andrey Logvin <landrey@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32715}
This commit is contained in:
Andrey Logvin
2020-11-27 15:06:48 +00:00
committed by Commit Bot
parent cde4a9f669
commit bcca3b08a9

View File

@ -225,16 +225,16 @@ def UploadToDashboard(options):
response, content = _SendHistogramSet(options.dashboard_url, histograms)
if response.status != 200:
print('Upload failed with %d: %s\n\n%s' % (response.status,
response.reason, content))
return 1
upload_token = json.loads(content).get('token')
if not options.wait_for_upload or not upload_token:
print 'Not waiting for upload status confirmation.'
if response.status == 200:
print 'Received 200 from dashboard.'
return 0
else:
print('Upload failed with %d: %s\n\n%s' % (response.status,
response.reason, content))
return 1
print('Received 200 from dashboard. ',
'Not waiting for the upload status confirmation.')
return 0
response, resp_json = _WaitForUploadConfirmation(
options.dashboard_url,
@ -253,6 +253,6 @@ def UploadToDashboard(options):
str(resp_json)))
return 1
print('Upload wasn\'t completed in a given time: %d seconds.',
print('Upload wasn\'t completed in a given time: %d seconds.' %
options.wait_timeout_sec)
return 1