comparison piecrust/baking/worker.py @ 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 a8a12f97addf
children ed5ccd4cce49
comparison
equal deleted inserted replaced
424:5feb71d31a4f 425:afeebdd9f767
17 w = BakeWorker(wid, ctx) 17 w = BakeWorker(wid, ctx)
18 w.run() 18 w.run()
19 19
20 20
21 class BakeWorkerContext(object): 21 class BakeWorkerContext(object):
22 def __init__(self, root_dir, out_dir, 22 def __init__(self, root_dir, sub_cache_dir, out_dir,
23 work_queue, results, abort_event, 23 work_queue, results, abort_event,
24 force=False, debug=False): 24 force=False, debug=False):
25 self.root_dir = root_dir 25 self.root_dir = root_dir
26 self.sub_cache_dir = sub_cache_dir
26 self.out_dir = out_dir 27 self.out_dir = out_dir
27 self.work_queue = work_queue 28 self.work_queue = work_queue
28 self.results = results 29 self.results = results
29 self.abort_event = abort_event 30 self.abort_event = abort_event
30 self.force = force 31 self.force = force
49 logger.debug("Working %d initializing..." % self.wid) 50 logger.debug("Working %d initializing..." % self.wid)
50 work_start_time = time.perf_counter() 51 work_start_time = time.perf_counter()
51 52
52 # Create the app local to this worker. 53 # Create the app local to this worker.
53 app = PieCrust(self.ctx.root_dir, debug=self.ctx.debug) 54 app = PieCrust(self.ctx.root_dir, debug=self.ctx.debug)
55 app._useSubCacheDir(self.ctx.sub_cache_dir)
54 app.env.fs_cache_only_for_main_page = True 56 app.env.fs_cache_only_for_main_page = True
55 app.env.registerTimer("BakeWorker_%d_Total" % self.wid) 57 app.env.registerTimer("BakeWorker_%d_Total" % self.wid)
56 app.env.registerTimer("BakeWorkerInit") 58 app.env.registerTimer("BakeWorkerInit")
57 app.env.registerTimer("JobReceive") 59 app.env.registerTimer("JobReceive")
58 60