start_datetime = get_start_time(lines, log_created_year)
assert start_datetime, 'Start time not found'
+ last_dt = start_datetime
out = open(output_file, 'w')
for line in lines:
line = line.strip()
if line.find('Iteration') != -1:
dt = extract_datetime_from_line(line, log_created_year)
+
+ # if it's another year
+ if dt.month < last_dt.month:
+ log_created_year += 1
+ dt = extract_datetime_from_line(line, log_created_year)
+ last_dt = dt
+
elapsed_seconds = (dt - start_datetime).total_seconds()
out.write('%f\n' % elapsed_seconds)
out.close()
logfile_year = extract_seconds.get_log_created_year(path_to_log)
with open(path_to_log) as f:
start_time = extract_seconds.get_start_time(f, logfile_year)
+ last_time = start_time
for line in f:
iteration_match = regex_iteration.search(line)
# Skip lines with bad formatting, for example when resuming solver
continue
+ # if it's another year
+ if time.month < last_time.month:
+ logfile_year += 1
+ time = extract_seconds.extract_datetime_from_line(line, logfile_year)
+ last_time = time
+
seconds = (time - start_time).total_seconds()
learning_rate_match = regex_learning_rate.search(line)