Mercurial > piecrust2
diff piecrust/sources/mixins.py @ 411:e7b865f8f335
bake: Enable multiprocess baking.
Baking is now done by running a worker per CPU, and sending jobs to them.
This changes several things across the codebase:
* Ability to not cache things related to pages other than the 'main' page
(i.e. the page at the bottom of the execution stack).
* Decouple the baking process from the bake records, so only the main process
keeps track (and modifies) the bake record.
* Remove the need for 'batch page getters' and loading a page directly from
the page factories.
There are various smaller changes too included here, including support for
scope performance timers that are saved with the bake record and can be
printed out to the console. Yes I got carried away.
For testing, the in-memory 'mock' file-system doesn't work anymore, since
we're spawning processes, so this is replaced by a 'tmpfs' file-system which
is saved in temporary files on disk and deleted after tests have run.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 12 Jun 2015 17:09:19 -0700 |
parents | 4b1019bb2533 |
children | 32c7c2d219d2 |
line wrap: on
line diff
--- a/piecrust/sources/mixins.py Sat May 30 15:41:52 2015 -0700 +++ b/piecrust/sources/mixins.py Fri Jun 12 17:09:19 2015 -0700 @@ -5,7 +5,7 @@ from piecrust.data.filters import PaginationFilter, page_value_accessor from piecrust.sources.base import PageFactory from piecrust.sources.interfaces import IPaginationSource, IListableSource -from piecrust.sources.pageref import PageNotFoundError +from piecrust.sources.pageref import PageRef logger = logging.getLogger(__name__) @@ -41,13 +41,15 @@ if self._taxonomy_pages is not None: return + app = self.source.app self._taxonomy_pages = set() - for tax in self.source.app.taxonomies: - page_ref = tax.getPageRef(self.source.name) - try: - self._taxonomy_pages.add(page_ref.rel_path) - except PageNotFoundError: - pass + for src in app.sources: + for tax in app.taxonomies: + ref_spec = src.getTaxonomyPageRef(tax.name) + page_ref = PageRef(app, ref_spec) + for sn, rp in page_ref.possible_split_ref_specs: + if sn == self.source.name: + self._taxonomy_pages.add(rp) class DateSortIterator(object):