We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
nuopc run complete message location 
In commit b9d7b65fd case_run.py was changed to look for the run completed message in drv.log instead of in med.log
for nuopc runs, however the system_tests_common.py was not changed to correspond.   PR incoming.
@mvertens @uturuncoglu 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `scripts/lib/CIME/SystemTests/nodefail.py`
Content:
```
1 """
2 CIME restart upon failed node test.
3 """
4 from CIME.XML.standard_module_setup import *
5 from CIME.SystemTests.ers import ERS
6 from CIME.utils import get_model
7 
8 logger = logging.getLogger(__name__)
9 
10 class NODEFAIL(ERS):
11 
12     def __init__(self, case):
13         """
14         initialize an object interface to the ERS system test
15         """
16         ERS.__init__(self, case)
17 
18         self._fail_sentinel = os.path.join(case.get_value("RUNDIR"), "FAIL_SENTINEL")
19         self._fail_str      = case.get_value("NODE_FAIL_REGEX")
20 
21     def _restart_fake_phase(self):
22         # Swap out model.exe for one that emits node failures
23         rundir = self._case.get_value("RUNDIR")
24         exeroot = self._case.get_value("EXEROOT")
25         driver = self._case.get_value("COMP_INTERFACE")
26         if driver == "nuopc":
27             logname = "med"
28         else:
29             logname = "cpl"
30         fake_exe = \
31 """#!/bin/bash
32 
33 fail_sentinel={0}
34 cpl_log={1}/{4}.log.$LID
35 model_log={1}/{2}.log.$LID
36 touch $cpl_log
37 touch $fail_sentinel
38 declare -i num_fails=$(cat $fail_sentinel | wc -l)
39 declare -i times_to_fail=${{NODEFAIL_NUM_FAILS:-3}}
40 
41 if ((num_fails < times_to_fail)); then
42   echo FAKE FAIL >> $cpl_log
43   echo FAIL >> $fail_sentinel
44   echo '{3}' >> $model_log
45   sleep 1
46   exit -1
47 else
48   echo Insta pass
49   echo SUCCESSFUL TERMINATION > $cpl_log
50 fi
51 """.format(self._fail_sentinel, rundir, get_model(), self._fail_str, logname)
52 
53         fake_exe_file = os.path.join(exeroot, "fake.sh")
54         with open(fake_exe_file, "w") as fd:
55             fd.write(fake_exe)
56 
57         os.chmod(fake_exe_file, 0o755)
58 
59         prev_run_exe = self._case.get_value("run_exe")
60         env_mach_specific = self._case.get_env("mach_specific")
61         env_mach_specific.set_value("run_exe", fake_exe_file)
62         self._case.flush(flushall=True)
63 
64         # This flag is needed by mpt to run a script under mpiexec
65         mpilib = self._case.get_value("MPILIB")
66         if mpilib == "mpt":
67             os.environ["MPI_SHEPHERD"] = "true"
68 
69         self.run_indv(suffix=None)
70 
71         if mpilib == "mpt":
72             del os.environ["MPI_SHEPHERD"]
73 
74         env_mach_specific = self._case.get_env("mach_specific")
75         env_mach_specific.set_value("run_exe", prev_run_exe)
76         self._case.flush(flushall=True)
77 
78     def run_phase(self):
79         self._ers_first_phase()
80         self._restart_fake_phase()
81         self._ers_second_phase()
82
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/scripts/lib/CIME/SystemTests/nodefail.py b/scripts/lib/CIME/SystemTests/nodefail.py
--- a/scripts/lib/CIME/SystemTests/nodefail.py
+++ b/scripts/lib/CIME/SystemTests/nodefail.py
@@ -24,7 +24,7 @@
         exeroot = self._case.get_value("EXEROOT")
         driver = self._case.get_value("COMP_INTERFACE")
         if driver == "nuopc":
-            logname = "med"
+            logname = "drv"
         else:
             logname = "cpl"
         fake_exe = \

{"golden_diff": "diff --git a/scripts/lib/CIME/SystemTests/nodefail.py b/scripts/lib/CIME/SystemTests/nodefail.py\n--- a/scripts/lib/CIME/SystemTests/nodefail.py\n+++ b/scripts/lib/CIME/SystemTests/nodefail.py\n@@ -24,7 +24,7 @@\n         exeroot = self._case.get_value(\"EXEROOT\")\n         driver = self._case.get_value(\"COMP_INTERFACE\")\n         if driver == \"nuopc\":\n-            logname = \"med\"\n+            logname = \"drv\"\n         else:\n             logname = \"cpl\"\n         fake_exe = \\\n", "issue": "nuopc run complete message location \nIn commit b9d7b65fd case_run.py was changed to look for the run completed message in drv.log instead of in med.log\r\nfor nuopc runs, however the system_tests_common.py was not changed to correspond.   PR incoming.\r\n@mvertens @uturuncoglu \n", "before_files": [{"content": "\"\"\"\nCIME restart upon failed node test.\n\"\"\"\nfrom CIME.XML.standard_module_setup import *\nfrom CIME.SystemTests.ers import ERS\nfrom CIME.utils import get_model\n\nlogger = logging.getLogger(__name__)\n\nclass NODEFAIL(ERS):\n\n    def __init__(self, case):\n        \"\"\"\n        initialize an object interface to the ERS system test\n        \"\"\"\n        ERS.__init__(self, case)\n\n        self._fail_sentinel = os.path.join(case.get_value(\"RUNDIR\"), \"FAIL_SENTINEL\")\n        self._fail_str      = case.get_value(\"NODE_FAIL_REGEX\")\n\n    def _restart_fake_phase(self):\n        # Swap out model.exe for one that emits node failures\n        rundir = self._case.get_value(\"RUNDIR\")\n        exeroot = self._case.get_value(\"EXEROOT\")\n        driver = self._case.get_value(\"COMP_INTERFACE\")\n        if driver == \"nuopc\":\n            logname = \"med\"\n        else:\n            logname = \"cpl\"\n        fake_exe = \\\n\"\"\"#!/bin/bash\n\nfail_sentinel={0}\ncpl_log={1}/{4}.log.$LID\nmodel_log={1}/{2}.log.$LID\ntouch $cpl_log\ntouch $fail_sentinel\ndeclare -i num_fails=$(cat $fail_sentinel | wc -l)\ndeclare -i times_to_fail=${{NODEFAIL_NUM_FAILS:-3}}\n\nif ((num_fails < times_to_fail)); then\n  echo FAKE FAIL >> $cpl_log\n  echo FAIL >> $fail_sentinel\n  echo '{3}' >> $model_log\n  sleep 1\n  exit -1\nelse\n  echo Insta pass\n  echo SUCCESSFUL TERMINATION > $cpl_log\nfi\n\"\"\".format(self._fail_sentinel, rundir, get_model(), self._fail_str, logname)\n\n        fake_exe_file = os.path.join(exeroot, \"fake.sh\")\n        with open(fake_exe_file, \"w\") as fd:\n            fd.write(fake_exe)\n\n        os.chmod(fake_exe_file, 0o755)\n\n        prev_run_exe = self._case.get_value(\"run_exe\")\n        env_mach_specific = self._case.get_env(\"mach_specific\")\n        env_mach_specific.set_value(\"run_exe\", fake_exe_file)\n        self._case.flush(flushall=True)\n\n        # This flag is needed by mpt to run a script under mpiexec\n        mpilib = self._case.get_value(\"MPILIB\")\n        if mpilib == \"mpt\":\n            os.environ[\"MPI_SHEPHERD\"] = \"true\"\n\n        self.run_indv(suffix=None)\n\n        if mpilib == \"mpt\":\n            del os.environ[\"MPI_SHEPHERD\"]\n\n        env_mach_specific = self._case.get_env(\"mach_specific\")\n        env_mach_specific.set_value(\"run_exe\", prev_run_exe)\n        self._case.flush(flushall=True)\n\n    def run_phase(self):\n        self._ers_first_phase()\n        self._restart_fake_phase()\n        self._ers_second_phase()\n", "path": "scripts/lib/CIME/SystemTests/nodefail.py"}], "after_files": [{"content": "\"\"\"\nCIME restart upon failed node test.\n\"\"\"\nfrom CIME.XML.standard_module_setup import *\nfrom CIME.SystemTests.ers import ERS\nfrom CIME.utils import get_model\n\nlogger = logging.getLogger(__name__)\n\nclass NODEFAIL(ERS):\n\n    def __init__(self, case):\n        \"\"\"\n        initialize an object interface to the ERS system test\n        \"\"\"\n        ERS.__init__(self, case)\n\n        self._fail_sentinel = os.path.join(case.get_value(\"RUNDIR\"), \"FAIL_SENTINEL\")\n        self._fail_str      = case.get_value(\"NODE_FAIL_REGEX\")\n\n    def _restart_fake_phase(self):\n        # Swap out model.exe for one that emits node failures\n        rundir = self._case.get_value(\"RUNDIR\")\n        exeroot = self._case.get_value(\"EXEROOT\")\n        driver = self._case.get_value(\"COMP_INTERFACE\")\n        if driver == \"nuopc\":\n            logname = \"drv\"\n        else:\n            logname = \"cpl\"\n        fake_exe = \\\n\"\"\"#!/bin/bash\n\nfail_sentinel={0}\ncpl_log={1}/{4}.log.$LID\nmodel_log={1}/{2}.log.$LID\ntouch $cpl_log\ntouch $fail_sentinel\ndeclare -i num_fails=$(cat $fail_sentinel | wc -l)\ndeclare -i times_to_fail=${{NODEFAIL_NUM_FAILS:-3}}\n\nif ((num_fails < times_to_fail)); then\n  echo FAKE FAIL >> $cpl_log\n  echo FAIL >> $fail_sentinel\n  echo '{3}' >> $model_log\n  sleep 1\n  exit -1\nelse\n  echo Insta pass\n  echo SUCCESSFUL TERMINATION > $cpl_log\nfi\n\"\"\".format(self._fail_sentinel, rundir, get_model(), self._fail_str, logname)\n\n        fake_exe_file = os.path.join(exeroot, \"fake.sh\")\n        with open(fake_exe_file, \"w\") as fd:\n            fd.write(fake_exe)\n\n        os.chmod(fake_exe_file, 0o755)\n\n        prev_run_exe = self._case.get_value(\"run_exe\")\n        env_mach_specific = self._case.get_env(\"mach_specific\")\n        env_mach_specific.set_value(\"run_exe\", fake_exe_file)\n        self._case.flush(flushall=True)\n\n        # This flag is needed by mpt to run a script under mpiexec\n        mpilib = self._case.get_value(\"MPILIB\")\n        if mpilib == \"mpt\":\n            os.environ[\"MPI_SHEPHERD\"] = \"true\"\n\n        self.run_indv(suffix=None)\n\n        if mpilib == \"mpt\":\n            del os.environ[\"MPI_SHEPHERD\"]\n\n        env_mach_specific = self._case.get_env(\"mach_specific\")\n        env_mach_specific.set_value(\"run_exe\", prev_run_exe)\n        self._case.flush(flushall=True)\n\n    def run_phase(self):\n        self._ers_first_phase()\n        self._restart_fake_phase()\n        self._ers_second_phase()\n", "path": "scripts/lib/CIME/SystemTests/nodefail.py"}]}