Skip to content

Commit

Permalink
Merge branch 'main' into nml_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
grantfirl committed Aug 10, 2024
2 parents de3cab1 + 93eaf52 commit 4964678
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ccpp/physics
Submodule physics updated 0 files
37 changes: 26 additions & 11 deletions scm/src/run_scm.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,28 +774,37 @@ 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
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):
# error_log contains header, subtracting 1 from error
passing_count = logs.shape[0] - 1
print(f"[{passing_count}/{total_count}] passing cases")
if (failing):
error_count = logs.shape[0] - 1
print(f"[{error_count}/{total_count}] failed cases")


class MaxStrLengths:
Expand Down Expand Up @@ -827,7 +836,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)

Expand Down Expand Up @@ -883,6 +893,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
Expand Down Expand Up @@ -959,6 +970,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}'. \
Expand All @@ -973,8 +987,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)


Expand Down

0 comments on commit 4964678

Please sign in to comment.