Skip to content

Commit

Permalink
Merge pull request #4481 from ESMCI/fix_inputdata_check
Browse files Browse the repository at this point in the history
Moves check_input_data to SystemTestsCommon when running a test
  • Loading branch information
jasonb5 authored Sep 8, 2023
2 parents fc94b9f + 3fe8197 commit d3d49c2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CIME/SystemTests/system_tests_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,15 @@ def run_indv(
stop_option = self._case.get_value("STOP_OPTION")
run_type = self._case.get_value("RUN_TYPE")
rundir = self._case.get_value("RUNDIR")
try:
self._case.check_all_input_data()
except CIMEError:
caseroot = self._case.get_value("CASEROOT")
raise CIMEError(
"Could not find all inputdata on any server, try "
"manually running `./check_input_data --download "
f"--versbose` from {caseroot!r}."
) from None
if submit_resubmits is None:
do_resub = self._case.get_value("BATCH_SYSTEM") != "none"
else:
Expand Down
3 changes: 2 additions & 1 deletion CIME/case/case_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ def check_case(self, skip_pnl=False, chksum=False):
if not skip_pnl:
self.create_namelists() # Must be called before check_all_input_data
logger.info("Checking that inputdata is available as part of case submission")
self.check_all_input_data(chksum=chksum)
if not self.get_value("TEST"):
self.check_all_input_data(chksum=chksum)

if self.get_value("COMP_WAV") == "ww":
# the ww3 buildnml has dependencies on inputdata so we must run it again
Expand Down
10 changes: 10 additions & 0 deletions CIME/tests/test_unit_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,20 @@ def make_valid_case(path):
class TestCaseSubmit(unittest.TestCase):
def test_check_case(self):
case = mock.MagicMock()
# get_value arguments TEST, COMP_WAV, COMP_INTERFACE, BUILD_COMPLETE
case.get_value.side_effect = [False, "", "", True]
case_submit.check_case(case, chksum=True)

case.check_all_input_data.assert_called_with(chksum=True)

def test_check_case_test(self):
case = mock.MagicMock()
# get_value arguments TEST, COMP_WAV, COMP_INTERFACE, BUILD_COMPLETE
case.get_value.side_effect = [True, "", "", True]
case_submit.check_case(case, chksum=True)

case.check_all_input_data.assert_not_called()

@mock.patch("CIME.case.case_submit.lock_file")
@mock.patch("CIME.case.case_submit.unlock_file")
@mock.patch("os.path.basename")
Expand Down

0 comments on commit d3d49c2

Please sign in to comment.