Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: download_from_google_storage.py

Issue 1824223002: Retry errors setting executable headers. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: CL comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | upload_to_google_storage.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: download_from_google_storage.py
diff --git a/download_from_google_storage.py b/download_from_google_storage.py
index b186c63ad44f0a9fccaa76eea8c28853b00c7f10..d71de9868cd42538e1103fbe92dec6d56fe19f97 100755
--- a/download_from_google_storage.py
+++ b/download_from_google_storage.py
@@ -55,6 +55,11 @@ def GetNormalizedPlatform():
class Gsutil(object):
"""Call gsutil with some predefined settings. This is a convenience object,
and is also immutable."""
+
+ MAX_TRIES = 5
+ RETRY_BASE_DELAY = 5.0
+ RETRY_DELAY_MULTIPLE = 1.3
+
def __init__(self, path, boto_path=None, timeout=None, version='4.15'):
if not os.path.exists(path):
raise FileNotFoundError('GSUtil not found in %s' % path)
@@ -100,6 +105,18 @@ class Gsutil(object):
return (404, out, err)
return (code, out, err)
+ def check_call_with_retries(self, *args):
+ delay = self.RETRY_BASE_DELAY
+ for i in xrange(self.MAX_TRIES):
+ code, out, err = self.check_call(*args)
+ if not code or i == self.MAX_TRIES - 1:
+ break
+
+ time.sleep(delay)
+ delay *= self.RETRY_DELAY_MULTIPLE
+
+ return code, out, err
+
def check_platform(target):
"""Checks if any parent directory of target matches (win|mac|linux)."""
« no previous file with comments | « no previous file | upload_to_google_storage.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698