Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow skipping tests that have a baseline already #4737

Merged
merged 16 commits into from
Jan 23, 2025
Merged
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion CIME/scripts/create_test.py
Original file line number Diff line number Diff line change
@@ -351,14 +351,29 @@ def parse_command_line(args, description):
config, "ALLOW_BASELINE_OVERWRITE", False, check_main=False
)

default = get_default_setting(
config, "ALLOW_BASELINE_SKIP", False, check_main=False
)

parser.add_argument(
"-o",
"--allow-baseline-overwrite",
action="store_true",
default=default,
help="If the --generate option is given, then an attempt to overwrite "
"\nan existing baseline directory will raise an error. WARNING: Specifying this "
"\noption will allow existing baseline directories to be silently overwritten.",
"\noption will allow existing baseline directories to be silently overwritten. "
"\nIncompatible with --allow-baseline-skip.",
)

parser.add_argument(
"--allow-baseline-skip",
action="store_true",
default=default,
help="If the --generate option is given, then an attempt to overwrite "
"\nan existing baseline directory will raise an error. WARNING: Specifying this "
"\noption will allow tests with existing baseline directories to be silently skipped. "
"\nIncompatible with -o/--allow-baseline-overwrite.",
)

default = get_default_setting(config, "WAIT", False, check_main=False)
@@ -503,6 +518,12 @@ def parse_command_line(args, description):
"Cannot force a rebuild without 'use-existing' and 'test-id'",
)

# baseline overwrite and skip can't be simultaneously specified
expect(
not (args.allow_baseline_overwrite and args.allow_baseline_skip),
"Cannot skip and overwrite baselines at the same time",
)

# generate and compare flags may not point to the same directory
if model_config.create_test_flag_mode == "cesm":
if args.generate is not None:
@@ -759,6 +780,7 @@ def parse_command_line(args, description):
args.save_timing,
args.queue,
args.allow_baseline_overwrite,
args.allow_baseline_skip,
args.output_root,
args.wait,
args.force_procs,
@@ -921,6 +943,7 @@ def create_test(
save_timing,
queue,
allow_baseline_overwrite,
allow_baseline_skip,
output_root,
wait,
force_procs,
@@ -969,6 +992,7 @@ def create_test(
save_timing=save_timing,
queue=queue,
allow_baseline_overwrite=allow_baseline_overwrite,
allow_baseline_skip=allow_baseline_skip,
output_root=output_root,
force_procs=force_procs,
force_threads=force_threads,
@@ -1068,6 +1092,7 @@ def _main_func(description=None):
save_timing,
queue,
allow_baseline_overwrite,
allow_baseline_skip,
output_root,
wait,
force_procs,
@@ -1122,6 +1147,7 @@ def _main_func(description=None):
save_timing,
queue,
allow_baseline_overwrite,
allow_baseline_skip,
output_root,
wait,
force_procs,
12 changes: 10 additions & 2 deletions CIME/test_scheduler.py
Original file line number Diff line number Diff line change
@@ -196,6 +196,7 @@ def __init__(
save_timing=False,
queue=None,
allow_baseline_overwrite=False,
allow_baseline_skip=False,
output_root=None,
force_procs=None,
force_threads=None,
@@ -227,6 +228,7 @@ def __init__(
self._input_dir = input_dir
self._pesfile = pesfile
self._allow_baseline_overwrite = allow_baseline_overwrite
self._allow_baseline_skip = allow_baseline_skip
self._single_exe = single_exe
if self._single_exe:
self._allow_pnl = True
@@ -348,6 +350,8 @@ def __init__(
self._baseline_root, self._baseline_gen_name
)
existing_baselines = []
if allow_baseline_skip:
tests_to_skip = []
for test_name in test_names:
test_baseline = os.path.join(full_baseline_dir, test_name)
if os.path.isdir(test_baseline):
@@ -357,11 +361,15 @@ def __init__(
clear_folder(os.path.join(test_baseline, "CaseDocs"))
else:
clear_folder(test_baseline)
elif allow_baseline_skip:
tests_to_skip.append(test_name)
expect(
allow_baseline_overwrite or len(existing_baselines) == 0,
allow_baseline_overwrite or len(existing_baselines) == 0 or allow_baseline_skip,
"Baseline directories already exists {}\n"
"Use -o to avoid this error".format(existing_baselines),
"Use -o or --allow-baseline-skip to avoid this error".format(existing_baselines),
)
if allow_baseline_skip:
test_names = [test for test in test_names if test not in tests_to_skip]

if self._config.sort_tests:
_order_tests_by_runtime(test_names, self._baseline_root)
1 change: 1 addition & 0 deletions CIME/utils.py
Original file line number Diff line number Diff line change
@@ -260,6 +260,7 @@ def _read_cime_config_file():
"walltime",
"job_queue",
"allow_baseline_overwrite",
"allow_baseline_skip",
"wait",
"force_procs",
"force_threads",
Loading