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

Unified Diff: build/android/devil/utils/reraiser_thread.py

Issue 1415533007: [Android] Add sharding for AMP instrumentation tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor change to uirobot SetupTestShards. Created 5 years, 1 month 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/reraiser_thread.py
diff --git a/build/android/devil/utils/reraiser_thread.py b/build/android/devil/utils/reraiser_thread.py
index e108fc754fbe9befd62c25dfe1e68f97ef071161..5181ccb356e6a25df1e173c0313eb0a85516598b 100644
--- a/build/android/devil/utils/reraiser_thread.py
+++ b/build/android/devil/utils/reraiser_thread.py
@@ -213,16 +213,25 @@ def CurrentThreadGroup():
return None
-def RunAsync(funcs, watcher=None):
+def RunAsync(funcs, args=None, kwargs=None, watcher=None, names=None):
"""Executes the given functions in parallel and returns their results.
Args:
funcs: List of functions to perform on their own threads.
+ args: List of list of args to be passed to the corresponding func.
+ kwargs: List of dicts of kwargs to be passed to the corresponding func.
watcher: Watchdog object providing timeout, by default waits forever.
+ names: List of names for the threads.
Returns:
A list of return values in the order of the given functions.
"""
- thread_group = ReraiserThreadGroup(ReraiserThread(f) for f in funcs)
+ args = args or [None]*len(funcs)
jbudorick 2015/12/01 04:07:13 where's the linter when I need it... spaces around
+ kwargs = kwargs or [None]*len(funcs)
+ names = names or [None]*len(funcs)
+
+ thread_group = ReraiserThreadGroup(
+ ReraiserThread(f, args=a, kwargs=k, name=n)
jbudorick 2015/12/01 04:07:13 Adding these probably means you're abusing RunAsyn
+ for (f, a, k, n) in zip(funcs, args, kwargs, names))
thread_group.StartAll(will_block=True)
return thread_group.GetAllReturnValues(watcher=watcher)

Powered by Google App Engine
This is Rietveld 408576698