diff --git a/scm/src/run_scm.py b/scm/src/run_scm.py index 87d2020c..520e1fb9 100755 --- a/scm/src/run_scm.py +++ b/scm/src/run_scm.py @@ -774,28 +774,36 @@ def print_report_line(case_s, suite, namelist, max_str_lens): logging.info(f"| {case_s:<{case_l}} | {suite:<{suite_l}} | {namelist:<{namelist_l}} |") -def print_error_report(error_logs, total_count, max_str_lens): +def print_report(logs, total_count, max_str_lens, + passing=False, failing=False): case_l = max_str_lens.case suite_l = max_str_lens.suite namelist_l = max_str_lens.namelist status_l = max_str_lens.status # error_log contains header, subtracting 1 from error - error_count = error_logs.shape[0] - 1 + error_count = logs.shape[0] - 1 passing_count = total_count - error_count header_printed = False column_width = (case_l + suite_l + namelist_l + status_l + 13) - # print formatted asummary - print("Failure Summary:") + # print formatted summary + print("") + if (passing): + print("Passing Summary:") + if (failing): + print("Failure Summary:") print("-" * column_width) - for error_log in error_logs: - case_s, suite, namelist, status = error_log + for log in logs: + case_s, suite, namelist, status = log print(f"| {case_s:<{case_l}} | {suite:<{suite_l}} | {namelist:<{namelist_l}} | {status:<{status_l}} |") if not header_printed: print("-" * column_width) header_printed = True print("-" * column_width) - print(f"[{error_count}/{total_count}] failed cases, [{passing_count}/{total_count}] passing cases") + if (passing): + print(f"[{passing_count}/{total_count}] passing cases") + if (failing): + print(f"[{error_count}/{total_count}] failed cases") class MaxStrLengths: @@ -827,7 +835,8 @@ def find_max_str_lengths(run_list): def main(): (file, case, sdf, namelist, tracers, use_gdb, runtime, runtime_mult, docker, \ verbose, levels, npz_type, vert_coord_file, case_data_dir, n_itt_out, \ - n_itt_diag, run_dir, bin_dir, timestep, mpi_command, stop_on_error) = parse_arguments() + n_itt_diag, run_dir, bin_dir, timestep, mpi_command, stop_on_error \ + ) = parse_arguments() setup_logging(verbose) @@ -883,6 +892,7 @@ def main(): # setup variables error_logs = [["Failed Case", "Suite", "Namelist", "Status"]] + pass_logs = [["Passing Case", "Suite", "Namelist", "Status"]] max_str_lens = find_max_str_lengths(run_list) failed_case = False irun = 0 @@ -959,6 +969,9 @@ def main(): if status == 0: logging.info('Process "(case={0}, suite={1}, namelist={2}" completed successfully'. \ format(run["case"], run["suite"], active_suite.namelist)) + pass_logs = np.append(pass_logs, + [[run["case"], run["suite"], active_suite.namelist, status]], + axis=0) else: failed_case = True error_str = 'Process "(case={0}, suite={1}, namelist={2}" exited with code {3}'. \ @@ -973,8 +986,9 @@ def main(): if docker: copy_outdir(exp_dir) + print_report(pass_logs, len(run_list), max_str_lens, passing=True) if (failed_case): - print_error_report(error_logs, len(run_list), max_str_lens) + print_report(error_logs, len(run_list), max_str_lens, failing=True) sys.exit(1)