diff --git a/scripts/lib/CIME/case_submit.py b/scripts/lib/CIME/case_submit.py index b5bd61de3fa..d10032e56d7 100644 --- a/scripts/lib/CIME/case_submit.py +++ b/scripts/lib/CIME/case_submit.py @@ -71,9 +71,13 @@ def submit(case, job=None, resubmit=False, no_batch=False, batch_args=None): casebaseid = case.get_value("CASEBASEID") # This should take care of the race condition where the submitted job # begins immediately and tries to set RUN phase. We proactively assume - # a passed SUBMIT phase. + # a passed SUBMIT phase. If this state is already PASS, don't set it again + # because then we'll lose RUN phase info if it's there. This info is important + # for system_tests_common to know if it needs to reinitialize the test or not. with TestStatus(test_dir=caseroot, test_name=casebaseid) as ts: - ts.set_status(SUBMIT_PHASE, TEST_PASS_STATUS) + phase_status = ts.get_status(SUBMIT_PHASE) + if phase_status != TEST_PASS_STATUS: + ts.set_status(SUBMIT_PHASE, TEST_PASS_STATUS) try: functor = lambda: _submit(case, job, resubmit, no_batch, batch_args) diff --git a/scripts/lib/CIME/test_scheduler.py b/scripts/lib/CIME/test_scheduler.py index f9bcdeb336a..0915df9c202 100644 --- a/scripts/lib/CIME/test_scheduler.py +++ b/scripts/lib/CIME/test_scheduler.py @@ -737,6 +737,8 @@ def _setup_cs_files(self): template = template.replace("", os.path.join(self._cime_root,"scripts","Tools")).replace\ ("", self._test_id) + if not os.path.exists(self._test_root): + os.makedirs(self._test_root) cs_status_file = os.path.join(self._test_root, "cs.status.%s" % self._test_id) with open(cs_status_file, "w") as fd: fd.write(template)