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

Unified Diff: build/android/devil/android/decorators.py

Issue 1340603002: DeviceUtils: Make Install and PushChangedFiles respect instance retries / timeout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: min->max Created 5 years, 3 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 | build/android/devil/android/decorators_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/devil/android/decorators.py
diff --git a/build/android/devil/android/decorators.py b/build/android/devil/android/decorators.py
index 19b1ec20ecef4c2a17c82c0eb245fab0dbdb100e..b5d2ec6444513a7a4963d1e70351279cd6409d7a 100644
--- a/build/android/devil/android/decorators.py
+++ b/build/android/devil/android/decorators.py
@@ -116,7 +116,8 @@ def WithTimeoutAndRetriesDefaults(default_timeout, default_retries):
def WithTimeoutAndRetriesFromInstance(
default_timeout_name=DEFAULT_TIMEOUT_ATTR,
- default_retries_name=DEFAULT_RETRIES_ATTR):
+ default_retries_name=DEFAULT_RETRIES_ATTR,
+ min_default_timeout=None):
"""Returns a decorator that handles timeouts and retries.
The provided |default_timeout_name| and |default_retries_name| are used to
@@ -130,12 +131,16 @@ def WithTimeoutAndRetriesFromInstance(
instance.
default_retries_name: The name of the default retries attribute of the
instance.
+ min_timeout: Miniumum timeout to be used when using instance timeout.
Returns:
The actual decorator.
"""
def decorator(f):
def get_timeout(inst, *_args, **kwargs):
- return kwargs.get('timeout', getattr(inst, default_timeout_name))
+ ret = getattr(inst, default_timeout_name)
+ if min_default_timeout is not None:
+ ret = max(min_default_timeout, ret)
+ return kwargs.get('timeout', ret)
def get_retries(inst, *_args, **kwargs):
return kwargs.get('retries', getattr(inst, default_retries_name))
return _TimeoutRetryWrapper(f, get_timeout, get_retries, pass_values=True)
« no previous file with comments | « no previous file | build/android/devil/android/decorators_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698