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

Unified Diff: build/android/devil/utils/timeout_retry.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
Index: build/android/devil/utils/timeout_retry.py
diff --git a/build/android/devil/utils/timeout_retry.py b/build/android/devil/utils/timeout_retry.py
index 3e0dfe6d444784586affdc581b5d08a8d617b96b..e6c77f129ca24ce89d51f9aad17de05117d036c8 100644
--- a/build/android/devil/utils/timeout_retry.py
+++ b/build/android/devil/utils/timeout_retry.py
@@ -85,7 +85,7 @@ def CurrentTimeoutThread():
def WaitFor(condition, wait_period=5, max_tries=None):
"""Wait for a condition to become true.
- Repeadly call the function condition(), with no arguments, until it returns
+ Repeatedly call the function condition(), with no arguments, until it returns
a true value.
If called within a TimeoutRetryThread, it cooperates nicely with it.
@@ -126,7 +126,7 @@ def WaitFor(condition, wait_period=5, max_tries=None):
return None
-def Run(func, timeout, retries, args=None, kwargs=None):
+def Run(func, timeout, retries, args=None, kwargs=None, desc=None):
"""Runs the passed function in a separate thread with timeouts and retries.
Args:
@@ -135,6 +135,8 @@ def Run(func, timeout, retries, args=None, kwargs=None):
retries: the number of retries.
args: list of positional args to pass to |func|.
kwargs: dictionary of keyword args to pass to |func|.
+ desc: An optional description of |func| used in logging. If omitted,
+ |func.__name__| will be used.
Returns:
The return value of func(*args, **kwargs).
@@ -160,8 +162,12 @@ def Run(func, timeout, retries, args=None, kwargs=None):
try:
thread_group = reraiser_thread.ReraiserThreadGroup([child_thread])
thread_group.StartAll()
- thread_group.JoinAll(child_thread.GetWatcher())
- return ret[0]
+ while True:
+ thread_group.JoinAll(watcher=child_thread.GetWatcher(), timeout=60)
+ if thread_group.IsAlive():
+ logging.info('Still working on %s', desc if desc else func.__name__)
+ else:
+ return ret[0]
except:
child_thread.LogTimeoutException()
if num_try > retries:
« no previous file with comments | « build/android/devil/utils/reraiser_thread.py ('k') | build/android/pylib/local/device/local_device_test_run.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698