Mercurial > piecrust2
comparison piecrust/commands/builtin/baking.py @ 462:04abc97dd3b6
bake: Add CLI argument to specify job batch size.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 11 Jul 2015 18:49:50 -0700 |
parents | 4a43d7015b75 |
children | 456db44dcc53 |
comparison
equal
deleted
inserted
replaced
461:b015e38d4ee1 | 462:04abc97dd3b6 |
---|---|
40 parser.add_argument( | 40 parser.add_argument( |
41 '-w', '--workers', | 41 '-w', '--workers', |
42 help="The number of worker processes to spawn.", | 42 help="The number of worker processes to spawn.", |
43 type=int, default=-1) | 43 type=int, default=-1) |
44 parser.add_argument( | 44 parser.add_argument( |
45 '--batch-size', | |
46 help="The number of jobs per batch.", | |
47 type=int, default=-1) | |
48 parser.add_argument( | |
45 '--assets-only', | 49 '--assets-only', |
46 help="Only bake the assets (don't bake the web pages).", | 50 help="Only bake the assets (don't bake the web pages).", |
47 action='store_true') | 51 action='store_true') |
48 parser.add_argument( | 52 parser.add_argument( |
49 '--html-only', | 53 '--html-only', |
88 return 1 | 92 return 1 |
89 | 93 |
90 def _bakeSources(self, ctx, out_dir): | 94 def _bakeSources(self, ctx, out_dir): |
91 if ctx.args.workers > 0: | 95 if ctx.args.workers > 0: |
92 ctx.app.config.set('baker/workers', ctx.args.workers) | 96 ctx.app.config.set('baker/workers', ctx.args.workers) |
97 if ctx.args.batch_size > 0: | |
98 ctx.app.config.set('baker/batch_size', ctx.args.batch_size) | |
93 baker = Baker( | 99 baker = Baker( |
94 ctx.app, out_dir, | 100 ctx.app, out_dir, |
95 force=ctx.args.force) | 101 force=ctx.args.force) |
96 record = baker.bake() | 102 record = baker.bake() |
97 _merge_timers(record.timers, ctx.timers) | 103 _merge_timers(record.timers, ctx.timers) |