Commit 70565a8c authored by Paul Rich's avatar Paul Rich
Browse files

Additional accounting logging for boot script.

parent 49c7581a
...@@ -263,14 +263,17 @@ def main(): ...@@ -263,14 +263,17 @@ def main():
'from_mode': ','.join(initial_mode_list), 'from_mode': ','.join(initial_mode_list),
'to_mode': '%s:%s:%s' % (mcdram_mode, numa_mode, node_list), 'to_mode': '%s:%s:%s' % (mcdram_mode, numa_mode, node_list),
'successful': False, 'successful': False,
'start': None,
'end': None,
} }
if len(nodes_to_modify) != 0: #if we don't have to reboot, don't go through this. if len(nodes_to_modify) != 0: #if we don't have to reboot, don't go through this.
accounting_start_msg = ACCOUNTING_MSG_FMT % (time.strftime(ACCOUNTING_DATE_FMT, time.gmtime()), 'BS', jobid, accounting_start_msg = ACCOUNTING_MSG_FMT % (time.strftime(ACCOUNTING_DATE_FMT, time.gmtime()), 'BS', jobid,
"bootid=%s" % bootid) "bootid=%s blocked=%s" % (bootid, blocked))
with open(os.path.join(ACCOUNTING_LOG_PATH, accounting_log_filename), "a+") as acc_file: with open(os.path.join(ACCOUNTING_LOG_PATH, accounting_log_filename), "a+") as acc_file:
acc_file.write(accounting_start_msg + '\n') acc_file.write(accounting_start_msg + '\n')
logger.info("%s", accounting_start_msg) logger.info("%s", accounting_start_msg)
start = time.time() start = time.time()
reboot_info['start'] = start
compact_nodes_to_modify = compact_num_list(nodes_to_modify) compact_nodes_to_modify = compact_num_list(nodes_to_modify)
try: try:
if not reset_modes(compact_nodes_to_modify, mcdram_mode, numa_mode, if not reset_modes(compact_nodes_to_modify, mcdram_mode, numa_mode,
...@@ -294,7 +297,9 @@ def main(): ...@@ -294,7 +297,9 @@ def main():
reboot_info['successful'] = success reboot_info['successful'] = success
finally: finally:
reboot_info['boot_time'] = int(time.time() - start) end = time.time()
reboot_info['end'] = end
reboot_info['boot_time'] = int(end - start)
accounting_end_msg = ACCOUNTING_MSG_FMT % (time.strftime(ACCOUNTING_DATE_FMT, time.gmtime()), 'BE', jobid, accounting_end_msg = ACCOUNTING_MSG_FMT % (time.strftime(ACCOUNTING_DATE_FMT, time.gmtime()), 'BE', jobid,
dict_to_keyval_str(reboot_info)) dict_to_keyval_str(reboot_info))
with open(os.path.join(ACCOUNTING_LOG_PATH, accounting_log_filename), "a+") as acc_file: with open(os.path.join(ACCOUNTING_LOG_PATH, accounting_log_filename), "a+") as acc_file:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment