From 9246239abc1516395a65e4c9b3b1fd39e6d6eca7 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Tue, 14 Mar 2017 12:04:24 -0600 Subject: [PATCH] Couple fixes to recent PR that added SUBMIT phase. Cannot allow resubmit to lose RUN phase info of previous run. --- scripts/lib/CIME/case_submit.py | 8 ++++++-- scripts/lib/CIME/test_scheduler.py | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/lib/CIME/case_submit.py b/scripts/lib/CIME/case_submit.py index b5bd61de3fa7..d10032e56d79 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 f9bcdeb336a6..0915df9c2023 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)