From 11f3b3033bec0bfbe4df25696f3fe123275547f3 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 2 Jan 2025 07:48:17 -0700 Subject: [PATCH] add try except clauses to reduce errors in testing --- CIME/case/case_run.py | 2 +- CIME/status.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CIME/case/case_run.py b/CIME/case/case_run.py index 2815e53e932..3e7c8baa37d 100644 --- a/CIME/case/case_run.py +++ b/CIME/case/case_run.py @@ -499,7 +499,7 @@ def case_run(self, skip_pnl=False, set_continue_run=False, submit_resubmits=Fals # get the most recent cpl restart pointer file rundir = self.get_value("RUNDIR") - if drv_restart_pointer: + if drv_restart_pointer and not self._read_only_mode: pattern = os.path.join(rundir, "rpointer.cpl*") files = sorted(glob.glob(pattern), key=os.path.getmtime) if files: diff --git a/CIME/status.py b/CIME/status.py index 54692395580..08618c7219d 100644 --- a/CIME/status.py +++ b/CIME/status.py @@ -54,9 +54,15 @@ def append_case_status(phase, status, msg=None, caseroot=".", gitinterface=None) logger.debug("adding file {}".format(f)) gitinterface.git_operation("add", f) msg = msg if msg else " no message provided" - gitinterface.git_operation("commit", "-m", '"' + msg + '"') + push = True + try: + gitinterface.git_operation("commit", "-m", '"' + msg + '"') + except Exception as e: + print(e) + push = False + remote = gitinterface.git_operation("remote") - if remote: + if remote and push: with Timeout(30): gitinterface.git_operation("push", remote)