Chromium Code Reviews| Index: upload_to_google_storage.py |
| diff --git a/upload_to_google_storage.py b/upload_to_google_storage.py |
| index 4487457bdb2f8cba84203447f5cadeb8fcd39531..54fc89e8d04e8a0496d18036a36cf06ada3abc62 100755 |
| --- a/upload_to_google_storage.py |
| +++ b/upload_to_google_storage.py |
| @@ -39,6 +39,9 @@ find . -name .svn -prune -o -size +1000k -type f -print0 | %prog -0 -b bkt - |
| (Replace "bkt" with the name of a writable bucket.) |
| """ |
| +SET_EXECUTABLE_RETRY_DELAY = 5.0 |
| +SET_EXECUTABLE_MAX_TRIES = 6 |
|
tandrii(chromium)
2016/03/24 09:49:24
i think these are no longer neede.d
dsansome
2016/03/29 03:24:54
Oops thanks
|
| + |
| def get_md5(filename): |
| md5_calculator = hashlib.md5() |
| @@ -76,7 +79,7 @@ def _upload_worker( |
| file_url = '%s/%s' % (base_url, sha1_sum) |
| if gsutil.check_call('ls', file_url)[0] == 0 and not force: |
| # File exists, check MD5 hash. |
| - _, out, _ = gsutil.check_call('ls', '-L', file_url) |
| + _, out, _ = gsutil.check_call_with_retries('ls', '-L', file_url) |
| etag_match = re.search('ETag:\s+([a-z0-9]{32})', out) |
| if etag_match: |
| remote_md5 = etag_match.group(1) |
| @@ -97,7 +100,7 @@ def _upload_worker( |
| if gzip: |
| gsutil_args.extend(['-z', gzip]) |
| gsutil_args.extend([filename, file_url]) |
| - code, _, err = gsutil.check_call(*gsutil_args) |
| + code, _, err = gsutil.check_call_with_retries(*gsutil_args) |
|
tandrii(chromium)
2016/03/24 09:49:24
+hinoka@ I'm not sure retrying any non-0 code is a
hinoka
2016/03/24 11:28:54
In general I think if this one fails once, it migh
|
| if code != 0: |
| ret_codes.put( |
| (code, |
| @@ -109,13 +112,13 @@ def _upload_worker( |
| # the download script will check for to preserve the executable bit. |
| if not sys.platform.startswith('win'): |
| if os.stat(filename).st_mode & stat.S_IEXEC: |
| - code, _, err = gsutil.check_call('setmeta', '-h', |
| - 'x-goog-meta-executable:1', file_url) |
| - if code: |
| + code, _, err = gsutil.check_call_with_retries( |
| + 'setmeta', '-h', 'x-goog-meta-executable:1', file_url) |
| + if not code: |
| ret_codes.put( |
| (code, |
| - 'Encountered error on setting metadata on %s\n%s' % |
| - (file_url, err))) |
| + 'Encountered error on setting metadata on %s after %d ' |
| + 'tries\n%s' % (file_url, SET_EXECUTABLE_MAX_TRIES, err))) |
| def get_targets(args, parser, use_null_terminator): |