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

Side by Side Diff: build/android/devil/utils/parallelizer.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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """ Wrapper that allows method execution in parallel. 5 """ Wrapper that allows method execution in parallel.
6 6
7 This class wraps a list of objects of the same type, emulates their 7 This class wraps a list of objects of the same type, emulates their
8 interface, and executes any functions called on the objects in parallel 8 interface, and executes any functions called on the objects in parallel
9 in ReraiserThreads. 9 in ReraiserThreads.
10 10
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 r = type(self)(self._orig_objs) 175 r = type(self)(self._orig_objs)
176 r._objs = reraiser_thread.ReraiserThreadGroup( 176 r._objs = reraiser_thread.ReraiserThreadGroup(
177 [reraiser_thread.ReraiserThread( 177 [reraiser_thread.ReraiserThread(
178 f, args=tuple([o] + list(args)), kwargs=kwargs, 178 f, args=tuple([o] + list(args)), kwargs=kwargs,
179 name='%s(%s)' % (f.__name__, d)) 179 name='%s(%s)' % (f.__name__, d))
180 for d, o in zip(self._orig_objs, self._objs)]) 180 for d, o in zip(self._orig_objs, self._objs)])
181 r._objs.StartAll() # pylint: disable=W0212 181 r._objs.StartAll() # pylint: disable=W0212
182 return r 182 return r
183 183
184 def _assertNoShadow(self, attr_name): 184 def _assertNoShadow(self, attr_name):
185 """Ensures that |attr_name| isn't shadowing part of the wrapped obejcts. 185 """Ensures that |attr_name| isn't shadowing part of the wrapped objects.
186 186
187 If the wrapped objects _do_ have an |attr_name| attribute, it will be 187 If the wrapped objects _do_ have an |attr_name| attribute, it will be
188 inaccessible to clients. 188 inaccessible to clients.
189 189
190 Args: 190 Args:
191 attr_name: The attribute to check. 191 attr_name: The attribute to check.
192 Raises: 192 Raises:
193 AssertionError if the wrapped objects have an attribute named 'attr_name' 193 AssertionError if the wrapped objects have an attribute named 'attr_name'
194 or '_assertNoShadow'. 194 or '_assertNoShadow'.
195 """ 195 """
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 f: The function to call. 232 f: The function to call.
233 args: The positional args to pass to f. 233 args: The positional args to pass to f.
234 kwargs: The keyword args to pass to f. 234 kwargs: The keyword args to pass to f.
235 Returns: 235 Returns:
236 A Parallelizer wrapping the ReraiserThreadGroup running the map in 236 A Parallelizer wrapping the ReraiserThreadGroup running the map in
237 parallel. 237 parallel.
238 """ 238 """
239 r = super(SyncParallelizer, self).pMap(f, *args, **kwargs) 239 r = super(SyncParallelizer, self).pMap(f, *args, **kwargs)
240 r.pFinish(None) 240 r.pFinish(None)
241 return r 241 return r
242
OLDNEW
« no previous file with comments | « no previous file | build/android/devil/utils/reraiser_thread.py » ('j') | build/android/devil/utils/reraiser_thread.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698