changeset 425:afeebdd9f767

bake: Pass the sub-cache directory to the bake workers.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 25 Jun 2015 14:51:37 -0700
parents 5feb71d31a4f
children ed5ccd4cce49
files piecrust/baking/baker.py piecrust/baking/worker.py
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/baking/baker.py	Thu Jun 25 14:51:12 2015 -0700
+++ b/piecrust/baking/baker.py	Thu Jun 25 14:51:37 2015 -0700
@@ -548,7 +548,7 @@
         pool = _WorkerPool()
         for i in range(self.num_workers):
             ctx = BakeWorkerContext(
-                    self.app.root_dir, self.out_dir,
+                    self.app.root_dir, self.app.cache.base_dir, self.out_dir,
                     pool.queue, pool.results, pool.abort_event,
                     force=self.force, debug=self.app.debug)
             w = multiprocessing.Process(
--- a/piecrust/baking/worker.py	Thu Jun 25 14:51:12 2015 -0700
+++ b/piecrust/baking/worker.py	Thu Jun 25 14:51:37 2015 -0700
@@ -19,10 +19,11 @@
 
 
 class BakeWorkerContext(object):
-    def __init__(self, root_dir, out_dir,
+    def __init__(self, root_dir, sub_cache_dir, out_dir,
                  work_queue, results, abort_event,
                  force=False, debug=False):
         self.root_dir = root_dir
+        self.sub_cache_dir = sub_cache_dir
         self.out_dir = out_dir
         self.work_queue = work_queue
         self.results = results
@@ -51,6 +52,7 @@
 
         # Create the app local to this worker.
         app = PieCrust(self.ctx.root_dir, debug=self.ctx.debug)
+        app._useSubCacheDir(self.ctx.sub_cache_dir)
         app.env.fs_cache_only_for_main_page = True
         app.env.registerTimer("BakeWorker_%d_Total" % self.wid)
         app.env.registerTimer("BakeWorkerInit")