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

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

Issue 1370133004: [Android] Log once per minute while waiting for timeout_retry thread completion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/utils/reraiser_thread.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 b5d2ec6444513a7a4963d1e70351279cd6409d7a..c90532f95d7375d51f6fbeb05acc3cbfa208aae7 100644
--- a/build/android/devil/android/decorators.py
+++ b/build/android/devil/android/decorators.py
@@ -7,6 +7,7 @@ Function/method decorators that provide timeout and retry logic.
"""
import functools
+import itertools
import sys
import threading
@@ -33,12 +34,13 @@ def _TimeoutRetryWrapper(f, timeout_func, retries_func, pass_values=False):
The wrapped function.
"""
@functools.wraps(f)
- def TimeoutRetryWrapper(*args, **kwargs):
+ def timeout_retry_wrapper(*args, **kwargs):
timeout = timeout_func(*args, **kwargs)
retries = retries_func(*args, **kwargs)
if pass_values:
kwargs['timeout'] = timeout
kwargs['retries'] = retries
+ @functools.wraps(f)
def impl():
return f(*args, **kwargs)
try:
@@ -46,14 +48,17 @@ def _TimeoutRetryWrapper(f, timeout_func, retries_func, pass_values=False):
timeout_retry.TimeoutRetryThread):
return impl()
else:
- return timeout_retry.Run(impl, timeout, retries)
+ desc = '%s(%s)' % (f.__name__, ', '.join(itertools.chain(
+ (str(a) for a in args),
+ ('%s=%s' % (k, str(v)) for k, v in kwargs.iteritems()))))
+ return timeout_retry.Run(impl, timeout, retries, desc=desc)
except reraiser_thread.TimeoutError as e:
raise device_errors.CommandTimeoutError(str(e)), None, (
sys.exc_info()[2])
except cmd_helper.TimeoutError as e:
raise device_errors.CommandTimeoutError(str(e)), None, (
sys.exc_info()[2])
- return TimeoutRetryWrapper
+ return timeout_retry_wrapper
def WithTimeoutAndRetries(f):
« no previous file with comments | « no previous file | build/android/devil/utils/reraiser_thread.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698