Mercurial > piecrust2
comparison piecrust/baking/worker.py @ 868:8d25f76fce98
bake: Add ability to specify pipelines to exclude during the bake.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 12 Jun 2017 22:22:19 -0700 |
parents | 08e02c2a2a1a |
children | 504ddb370df8 |
comparison
equal
deleted
inserted
replaced
867:757fba54bfd3 | 868:8d25f76fce98 |
---|---|
12 | 12 |
13 | 13 |
14 class BakeWorkerContext(object): | 14 class BakeWorkerContext(object): |
15 def __init__(self, appfactory, out_dir, *, | 15 def __init__(self, appfactory, out_dir, *, |
16 force=False, previous_records_path=None, | 16 force=False, previous_records_path=None, |
17 allowed_pipelines=None): | 17 allowed_pipelines=None, forbidden_pipelines=None): |
18 self.appfactory = appfactory | 18 self.appfactory = appfactory |
19 self.out_dir = out_dir | 19 self.out_dir = out_dir |
20 self.force = force | 20 self.force = force |
21 self.previous_records_path = previous_records_path | 21 self.previous_records_path = previous_records_path |
22 self.allowed_pipelines = allowed_pipelines | 22 self.allowed_pipelines = allowed_pipelines |
23 self.forbidden_pipelines = forbidden_pipelines | |
23 | 24 |
24 | 25 |
25 class BakeWorker(IWorker): | 26 class BakeWorker(IWorker): |
26 def __init__(self, ctx): | 27 def __init__(self, ctx): |
27 self.ctx = ctx | 28 self.ctx = ctx |
57 | 58 |
58 # Create the pipelines. | 59 # Create the pipelines. |
59 self.ppmngr = PipelineManager( | 60 self.ppmngr = PipelineManager( |
60 app, self.ctx.out_dir, self.record_histories, | 61 app, self.ctx.out_dir, self.record_histories, |
61 worker_id=self.wid, force=self.ctx.force) | 62 worker_id=self.wid, force=self.ctx.force) |
63 ok_pp = self.ctx.allowed_pipelines | |
64 nok_pp = self.ctx.forbidden_pipelines | |
62 for src in app.sources: | 65 for src in app.sources: |
63 pname = get_pipeline_name_for_source(src) | 66 pname = get_pipeline_name_for_source(src) |
64 if (self.ctx.allowed_pipelines is not None and | 67 if ok_pp is not None and pname not in ok_pp: |
65 pname not in self.ctx.allowed_pipelines): | 68 continue |
69 if nok_pp is not None and pname in nok_pp: | |
66 continue | 70 continue |
67 | 71 |
68 self.ppmngr.createPipeline(src) | 72 self.ppmngr.createPipeline(src) |
69 | 73 |
70 stats.stepTimerSince("BakeWorkerInit", self._work_start_time) | 74 stats.stepTimerSince("BakeWorkerInit", self._work_start_time) |