202 data = LastUpdatedOrderedDict()
203
204
205 checklog_log = first_existing_file(['checklog.log', 'CheckLog.log'])
206 ne = get_num_from_checklog(checklog_log) if checklog_log else None
207 logging.debug("ne: {}".format(ne))
208 if ne is None:
209 logging.warning("Failed to read number of errors from the log")
210 data['num-errors'] = 'n/a'
211 else:
212 data['num-errors'] = ne
213
214
215 warnings_log = first_existing_file(['warnings.log', 'Warnings.log'])
216 nw = get_num_from_checklog(warnings_log) if warnings_log else None
217 logging.debug("nw: {}".format(nw))
218 if nw is None:
219 logging.warning("Failed to read number of warnings from the log")
220 data['num-warnings'] = 'n/a'
221 else:
222 data['num-warnings'] = nw
223
224
225 histcount_log = first_existing_file(['histSizes.log', 'HistCount.log'])
226 nh = get_num_histos(histcount_log) if histcount_log else None
227 logging.debug("nh: {}".format(nh))
228 if nh is None:
229 logging.warning("Failed to read number of histograms from the log")
230 data['num-histograms'] = 'n/a'
231 else:
232 data['num-histograms'] = nh
233
234
235 if do_prmon:
236 prmon_log = newest_file(r'prmon\..*\.txt')
237 if not prmon_log:
238 prmon_log = first_existing_file(['prmon.full.RDOtoRDOTrigger', 'prmon.full.RAWtoESD', 'prmon.full.ESDtoAOD', 'prmon.full.RAWtoALL'])
239 if not prmon_log:
240 logging.info("No prmon output found, the result will be empty")
241 data['prmon'] = 'n/a'
242 else:
243 logging.info("Analysing prmon output from %s", prmon_log)
244 prmon_data = analyse_prmon(prmon_log)
245 if prmon_data is None:
246 logging.warning("Could not analyse prmon output, the result will be empty")
247 data['prmon'] = 'n/a'
248 else:
249 data['prmon'] = prmon_data
250
251
252 perfmon_log = newest_file(r'.*perfmon\.summary\.txt')
253 if not perfmon_log:
254 logging.info("No PerfMon output found, the result will be empty")
255 data['memory-usage'] = 'n/a'
256 else:
257 logging.info("Analysing PerfMon output from %s", perfmon_log)
258 perfmon_data = analyse_perfmon(perfmon_log)
259 if perfmon_data is None:
260 logging.warning("Could not analyse PerfMon output, the result will be empty")
261 data['memory-usage'] = 'n/a'
262 else:
263 data['memory-usage'] = perfmon_data
264
265
266 with open('extra-results.json', 'w') as outfile:
267 json.dump(data, outfile, indent=4)
268
269