comparison piecrust/commands/builtin/baking.py @ 218:10f24c62b05b

showrecord: Show the overall status (success/failed) of the bake.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 31 Jan 2015 17:36:01 -0800
parents 1f4c3dae1fe8
children 84e2bc2d16cb
comparison
equal deleted inserted replaced
217:1f4c3dae1fe8 218:10f24c62b05b
106 record_cache = ctx.app.cache.getCache('baker') 106 record_cache = ctx.app.cache.getCache('baker')
107 if not record_cache.has(record_name): 107 if not record_cache.has(record_name):
108 raise Exception("No record has been created for this output path. " 108 raise Exception("No record has been created for this output path. "
109 "Did you bake there yet?") 109 "Did you bake there yet?")
110 110
111 # Show the bake record.
111 record = BakeRecord.load(record_cache.getCachePath(record_name)) 112 record = BakeRecord.load(record_cache.getCachePath(record_name))
112 logging.info("Bake record for: %s" % record.out_dir) 113 logging.info("Bake record for: %s" % record.out_dir)
113 logging.info("Last baked: %s" % 114 logging.info("Last baked: %s" %
114 datetime.datetime.fromtimestamp(record.bake_time)) 115 datetime.datetime.fromtimestamp(record.bake_time))
116 if record.success:
117 logging.info("Status: success")
118 else:
119 logging.error("Status: failed")
115 logging.info("Entries:") 120 logging.info("Entries:")
116 for entry in record.entries: 121 for entry in record.entries:
117 if pattern: 122 if pattern:
118 if not fnmatch.fnmatch(entry.rel_path, pattern): 123 if not fnmatch.fnmatch(entry.rel_path, pattern):
119 continue 124 continue
133 138
134 record_cache = ctx.app.cache.getCache('proc') 139 record_cache = ctx.app.cache.getCache('proc')
135 if not record_cache.has(record_name): 140 if not record_cache.has(record_name):
136 return 141 return
137 142
143 # Show the pipeline record.
138 record = ProcessorPipelineRecord.load( 144 record = ProcessorPipelineRecord.load(
139 record_cache.getCachePath(record_name)) 145 record_cache.getCachePath(record_name))
140 logging.info("") 146 logging.info("")
141 logging.info("Processing record for: %s" % record.out_dir) 147 logging.info("Processing record for: %s" % record.out_dir)
142 logging.info("Last baked: %s" % 148 logging.info("Last baked: %s" %
143 datetime.datetime.fromtimestamp(record.process_time)) 149 datetime.datetime.fromtimestamp(record.process_time))
150 if record.success:
151 logging.info("Status: success")
152 else:
153 logging.error("Status: failed")
144 logging.info("Entries:") 154 logging.info("Entries:")
145 for entry in record.entries: 155 for entry in record.entries:
146 if pattern: 156 if pattern:
147 if not fnmatch.fnmatch(entry.rel_input, pattern): 157 if not fnmatch.fnmatch(entry.rel_input, pattern):
148 continue 158 continue