Mercurial > piecrust2
changeset 191:308d5180bf81
processing: Add more information to the pipeline record.
We now save whether an asset was processed by an external tool that bypasses
the pipeline, and the tree of processor names involved.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 11 Jan 2015 23:01:21 -0800 |
parents | 430ee5b80962 |
children | 4c0ab0b044fe |
files | piecrust/processing/base.py piecrust/processing/records.py piecrust/processing/tree.py |
diffstat | 3 files changed, 25 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/piecrust/processing/base.py Sun Jan 11 22:58:38 2015 -0800 +++ b/piecrust/processing/base.py Sun Jan 11 23:01:21 2015 -0800 @@ -9,9 +9,11 @@ from piecrust.chefutil import format_timed from piecrust.processing.records import ( ProcessorPipelineRecordEntry, TransitionalProcessorPipelineRecord, - FLAG_PROCESSED, FLAG_OVERRIDEN) -from piecrust.processing.tree import (ProcessingTreeBuilder, - ProcessingTreeRunner, ProcessingTreeError, STATE_DIRTY, print_node) + FLAG_PROCESSED, FLAG_OVERRIDEN, FLAG_BYPASSED_STRUCTURED_PROCESSING) +from piecrust.processing.tree import ( + ProcessingTreeBuilder, ProcessingTreeRunner, ProcessingTreeError, + STATE_DIRTY, + print_node, get_node_name_tree) logger = logging.getLogger(__name__) @@ -324,6 +326,9 @@ print_node(tree_root, recursive=True) leaves = tree_root.getLeaves() record_entry.rel_outputs = [l.path for l in leaves] + record_entry.proc_tree = get_node_name_tree(tree_root) + if tree_root.getProcessor().is_bypassing_structured_processing: + record_entry.flags |= FLAG_BYPASSED_STRUCTURED_PROCESSING force = (pipeline.force or previous_entry is None or not previous_entry.was_processed_successfully)
--- a/piecrust/processing/records.py Sun Jan 11 22:58:38 2015 -0800 +++ b/piecrust/processing/records.py Sun Jan 11 23:01:21 2015 -0800 @@ -3,7 +3,7 @@ class ProcessorPipelineRecord(Record): - RECORD_VERSION = 2 + RECORD_VERSION = 3 def __init__(self): super(ProcessorPipelineRecord, self).__init__() @@ -34,6 +34,7 @@ FLAG_NONE = 0 FLAG_PROCESSED = 2**0 FLAG_OVERRIDEN = 2**1 +FLAG_BYPASSED_STRUCTURED_PROCESSING = 2**2 class ProcessorPipelineRecordEntry(object): @@ -43,6 +44,7 @@ self.flags = FLAG_NONE self.rel_outputs = [] + self.proc_tree = None self.errors = [] @property
--- a/piecrust/processing/tree.py Sun Jan 11 22:58:38 2015 -0800 +++ b/piecrust/processing/tree.py Sun Jan 11 23:01:21 2015 -0800 @@ -274,3 +274,17 @@ for o in node.outputs: print_node(o, None, True) + +def get_node_name_tree(node): + try: + proc_name = node.getProcessor().PROCESSOR_NAME + except ProcessorNotFoundError: + proc_name = 'n/a' + + children = [] + for o in node.outputs: + if not o.outputs: + continue + children.append(get_node_name_tree(o)) + return (proc_name, children) +