Mercurial > piecrust2
comparison piecrust/serving/procloop.py @ 880:342e3ea24b5d
serve: Fix asset processing loop.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 15 Jun 2017 22:55:32 -0700 |
parents | d1095774bfcf |
children | 7f1da7e7b154 |
comparison
equal
deleted
inserted
replaced
879:58ae026b4c31 | 880:342e3ea24b5d |
---|---|
5 import queue | 5 import queue |
6 import logging | 6 import logging |
7 import itertools | 7 import itertools |
8 import threading | 8 import threading |
9 from piecrust import CONFIG_PATH, THEME_CONFIG_PATH | 9 from piecrust import CONFIG_PATH, THEME_CONFIG_PATH |
10 from piecrust.chefutil import format_timed_scope | |
10 from piecrust.pipelines.base import ( | 11 from piecrust.pipelines.base import ( |
11 PipelineJobCreateContext, PipelineJobRunContext, PipelineJobResult, | 12 PipelineJobCreateContext, PipelineJobRunContext, PipelineJobResult, |
12 PipelineManager) | 13 PipelineManager) |
13 from piecrust.pipelines.records import ( | 14 from piecrust.pipelines.records import ( |
14 MultiRecord, MultiRecordHistory) | 15 MultiRecord, MultiRecordHistory) |
149 if os.path.getmtime(path) > procinfo.last_bake_time: | 150 if os.path.getmtime(path) > procinfo.last_bake_time: |
150 logger.debug("Found modified asset: %s" % path) | 151 logger.debug("Found modified asset: %s" % path) |
151 found_new_or_modified = True | 152 found_new_or_modified = True |
152 break | 153 break |
153 if found_new_or_modified: | 154 if found_new_or_modified: |
154 self._runPipelines(procinfo.source) | 155 with format_timed_scope( |
156 logger, | |
157 "change detected, reprocessed '%s'." % | |
158 procinfo.source.name): | |
159 self._runPipelines(procinfo.source) | |
155 | 160 |
156 time.sleep(self.interval) | 161 time.sleep(self.interval) |
157 | 162 |
158 def _init(self): | 163 def _init(self): |
159 self._app = self.appfactory.create() | 164 self._app = self.appfactory.create() |
248 try: | 253 try: |
249 pp.run(job, runctx, ppres) | 254 pp.run(job, runctx, ppres) |
250 except Exception as e: | 255 except Exception as e: |
251 ppres.record_entry.errors.append(str(e)) | 256 ppres.record_entry.errors.append(str(e)) |
252 | 257 |
253 if ppres.next_pass_job is not None: | 258 if ppres.next_step_job is not None: |
254 logger.error("The processing loop for the server " | 259 logger.error("The processing loop for the server " |
255 "doesn't support multi-pass pipelines.") | 260 "doesn't support multi-step pipelines.") |
256 | 261 |
257 cr.addEntry(ppres.record_entry) | 262 cr.addEntry(ppres.record_entry) |
258 if not ppres.record_entry.success: | 263 if not ppres.record_entry.success: |
259 cr.success = False | 264 cr.success = False |
260 current_records.success = False | 265 current_records.success = False |