Mercurial > piecrust2
view piecrust/sources/interfaces.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 | f130365568ff |
children | 0c74a6c4533d |
line wrap: on
line source
class IPaginationSource(object): """ Defines the interface for a source that can be used as the data for an iterator or a pagination. """ def getItemsPerPage(self): raise NotImplementedError() def getSourceIterator(self): raise NotImplementedError() def getSorterIterator(self, it): raise NotImplementedError() def getTailIterator(self, it): raise NotImplementedError() def getPaginationFilter(self, page): raise NotImplementedError() def getSettingAccessor(self): raise NotImplementedError() class IListableSource: """ Defines the interface for a source that can be iterated on in a hierarchical manner, for use with the `family` data endpoint. """ def listPath(self, rel_path): raise NotImplementedError() def getDirpath(self, rel_path): raise NotImplementedError() def getBasename(self, rel_path): raise NotImplementedError() class IPreparingSource: """ Defines the interface for a source whose pages can be created by the `chef prepare` command. """ def setupPrepareParser(self, parser, app): raise NotImplementedError() def buildMetadata(self, args): raise NotImplementedError()