diff piecrust/workerpool.py @ 453:8351a77e13f5

bake: Don't pass the previous record entries to the workers. Workers now load the previous record on their own and find the previous entry in their own copy.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 07 Jul 2015 20:19:54 -0700
parents 838f3964f400
children 55fc8918cb75
line wrap: on
line diff
--- a/piecrust/workerpool.py	Tue Jul 07 19:58:07 2015 -0700
+++ b/piecrust/workerpool.py	Tue Jul 07 20:19:54 2015 -0700
@@ -50,7 +50,13 @@
 
     w = params.worker_class(*params.initargs)
     w.wid = wid
-    w.initialize()
+    try:
+        w.initialize()
+    except Exception as ex:
+        logger.error("Working failed to initialize:")
+        logger.exception(ex)
+        params.outqueue.put(None)
+        return
 
     get = params.inqueue.get
     put = params.outqueue.put
@@ -152,6 +158,9 @@
         if self._listener is not None:
             raise Exception("A previous job queue has not finished yet.")
 
+        if any([not p.is_alive() for p in self._pool]):
+            raise Exception("Some workers have prematurely exited.")
+
         if handler is not None:
             self.setHandler(handler)