diff piecrust/baking/baker.py @ 691:9ae9390192da

bake: Use standard pickle and queue for now to fix some small issues. * JSON leads to some problems with integers as keys. * Add some stats to the baking process.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 21 Mar 2016 22:28:57 -0700
parents 61d606fbc313
children 5f552aedd918
line wrap: on
line diff
--- a/piecrust/baking/baker.py	Mon Mar 21 19:16:54 2016 -0700
+++ b/piecrust/baking/baker.py	Mon Mar 21 22:28:57 2016 -0700
@@ -191,6 +191,7 @@
         start_time = time.perf_counter()
         try:
             record.current.baked_count[realm] = 0
+            record.current.total_baked_count[realm] = 0
 
             all_factories = []
             for source in srclist:
@@ -203,10 +204,12 @@
             self._bakeRealmPages(record, pool, realm, all_factories)
         finally:
             page_count = record.current.baked_count[realm]
+            total_page_count = record.current.total_baked_count[realm]
             logger.info(format_timed(
                     start_time,
-                    "baked %d %s pages." %
-                    (page_count, REALM_NAMES[realm].lower())))
+                    "baked %d %s pages (%d total)." %
+                    (page_count, REALM_NAMES[realm].lower(),
+                        total_page_count)))
 
     def _loadRealmPages(self, record, pool, factories):
         def _handler(res):
@@ -297,6 +300,7 @@
                 record.current.success = False
             if entry.subs and entry.was_any_sub_baked:
                 record.current.baked_count[realm] += 1
+                record.current.total_baked_count[realm] += len(entry.subs)
 
         logger.debug("Baking %d realm pages..." % len(factories))
         with format_timed_scope(logger,