From: Dylan Baker <[email protected]> By using Multiprocessing.dummy.Pool.apply_async() instead of .imap(), an exception in the thread can be raised stopping the run of the suite.
Signed-off-by: Dylan Baker <[email protected]> cc: [email protected] --- This appears to work in my (brief) testing. It seems entirely too simple for how painful multi-threading usually is in python, but it also appears to work when I hack an exception into Test.execute. framework/profile.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/framework/profile.py b/framework/profile.py index 32ed759..cb893db 100644 --- a/framework/profile.py +++ b/framework/profile.py @@ -248,21 +248,20 @@ class TestProfile(object): self._pre_run_hook() - chunksize = 1 - self._prepare_test_list() log = LogManager(logger, len(self.test_list)) - def test(pair): + def test(name, test): """Function to call test.execute from map""" - name, test = pair with backend.write_test(name) as w: test.execute(name, log.get(), self.dmesg) w(test.result) def run_threads(pool, testlist): """ Open a pool, close it, and join it """ - pool.imap(test, testlist, chunksize) + for pair in testlist: + x = pool.apply_async(test, pair) + x.get() pool.close() pool.join() -- 2.6.3 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
