Skip to content

Commit 28bd2de

Browse files
committed
fix restart file existence check for multi instance runs
1 parent bc1ce37 commit 28bd2de

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

cime_config/buildnml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,13 @@ def prechecks(case, inst_suffixes):
399399
f"Missing rpointer files in rundir. Expected files with pattern {rpointer_pattern}.",
400400
)
401401

402-
# check if the restart file is present in rundir
402+
# check if the restart file is present in rundir for fresh branch or hybrid runs
403403
if run_type in ["branch", "hybrid"] and not continue_run and not get_refcase:
404-
restart_file = os.path.join(rundir, f'./{run_refcase}.mom6.r.{run_refdate}-{run_reftod}.nc')
405-
assert os.path.exists(restart_file), f"Missing restart file {run_refcase}.mom6.r.{run_refdate}-{run_reftod}.nc in rundir."
404+
restart_file_pattern = run_refcase + r".mom6.*.r." + run_refdate + "-" + run_reftod + r".*nc$"
405+
restart_files = [
406+
f for f in os.listdir(rundir) if re.match(restart_file_pattern, f)
407+
]
408+
assert len(restart_files) > 0, f"Missing restart file in rundir. Expected file matching pattern {restart_file_pattern}."
406409

407410
def postchecks(case, MOM_input_final):
408411
"""Performs checks after input files are generated. To be called within prep_input() as a final step."""

0 commit comments

Comments
 (0)