Mercurial > piecrust2
comparison piecrust/baking/baker.py @ 466:456db44dcc53
bake: Pass the config variants and values from the CLI to the baker.
TODO: add support for that for the processor pipeline.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 11 Jul 2015 23:51:02 -0700 |
parents | 04abc97dd3b6 |
children | 3ceeca7bb71c |
comparison
equal
deleted
inserted
replaced
465:b6e797463798 | 466:456db44dcc53 |
---|---|
1 import time | 1 import time |
2 import os.path | 2 import os.path |
3 import hashlib | 3 import hashlib |
4 import logging | 4 import logging |
5 import multiprocessing | |
6 from piecrust.baking.records import ( | 5 from piecrust.baking.records import ( |
7 BakeRecordEntry, TransitionalBakeRecord, TaxonomyInfo) | 6 BakeRecordEntry, TransitionalBakeRecord, TaxonomyInfo) |
8 from piecrust.baking.worker import ( | 7 from piecrust.baking.worker import ( |
9 save_factory, | 8 save_factory, |
10 JOB_LOAD, JOB_RENDER_FIRST, JOB_BAKE) | 9 JOB_LOAD, JOB_RENDER_FIRST, JOB_BAKE) |
17 | 16 |
18 logger = logging.getLogger(__name__) | 17 logger = logging.getLogger(__name__) |
19 | 18 |
20 | 19 |
21 class Baker(object): | 20 class Baker(object): |
22 def __init__(self, app, out_dir, force=False): | 21 def __init__(self, app, out_dir, force=False, |
22 applied_config_variant=None, | |
23 applied_config_values=None): | |
23 assert app and out_dir | 24 assert app and out_dir |
24 self.app = app | 25 self.app = app |
25 self.out_dir = out_dir | 26 self.out_dir = out_dir |
26 self.force = force | 27 self.force = force |
28 self.applied_config_variant = applied_config_variant | |
29 self.applied_config_values = applied_config_values | |
27 | 30 |
28 # Remember what taxonomy pages we should skip | 31 # Remember what taxonomy pages we should skip |
29 # (we'll bake them repeatedly later with each taxonomy term) | 32 # (we'll bake them repeatedly later with each taxonomy term) |
30 self.taxonomy_pages = [] | 33 self.taxonomy_pages = [] |
31 logger.debug("Gathering taxonomy page paths:") | 34 logger.debug("Gathering taxonomy page paths:") |
544 batch_size = self.app.config.get('baker/batch_size') | 547 batch_size = self.app.config.get('baker/batch_size') |
545 | 548 |
546 ctx = BakeWorkerContext( | 549 ctx = BakeWorkerContext( |
547 self.app.root_dir, self.app.cache.base_dir, self.out_dir, | 550 self.app.root_dir, self.app.cache.base_dir, self.out_dir, |
548 previous_record_path=previous_record_path, | 551 previous_record_path=previous_record_path, |
552 config_variant=self.applied_config_variant, | |
553 config_values=self.applied_config_values, | |
549 force=self.force, debug=self.app.debug) | 554 force=self.force, debug=self.app.debug) |
550 pool = WorkerPool( | 555 pool = WorkerPool( |
551 worker_count=worker_count, | 556 worker_count=worker_count, |
552 batch_size=batch_size, | 557 batch_size=batch_size, |
553 worker_class=BakeWorker, | 558 worker_class=BakeWorker, |