[Piglit] [PATCH] framework/profile.py: raise exception from pool.
baker.dylan.c at gmail.com
baker.dylan.c at gmail.com
Mon Dec 7 10:53:10 PST 2015
From: Dylan Baker <baker.dylan.c at gmail.com>
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 <dylanx.c.baker at intel.com>
cc: jfonseca at vmware.com
---
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
More information about the Piglit
mailing list