We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
notification options not preserved on resubmit
... got emails regarding a job I submitted via case.submit, had RESUBMIT=1, and I didn't get emails from the resubmission. 

--- 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/case/case_submit.py`
Content:
```
1 #!/usr/bin/env python
2 
3 """
4 case.submit - Submit a cesm workflow to the queueing system or run it
5 if there is no queueing system.  A cesm workflow may include multiple
6 jobs.
7 submit, check_case and check_da_settings are members of class Case in file case.py
8 """
9 import socket
10 from CIME.XML.standard_module_setup import *
11 from CIME.utils                     import expect, run_and_log_case_status, verbatim_success_msg
12 from CIME.locked_files              import unlock_file, lock_file
13 from CIME.test_status               import *
14 
15 logger = logging.getLogger(__name__)
16 
17 def _submit(case, job=None, no_batch=False, prereq=None, resubmit=False,
18             skip_pnl=False, mail_user=None, mail_type=None, batch_args=None):
19     if job is None:
20         job = case.get_primary_job()
21 
22     rundir = case.get_value("RUNDIR")
23     if job != "case.test":
24         continue_run = case.get_value("CONTINUE_RUN")
25         expect(os.path.isdir(rundir) or not continue_run,
26                " CONTINUE_RUN is true but RUNDIR {} does not exist".format(rundir))
27 
28     # if case.submit is called with the no_batch flag then we assume that this
29     # flag will stay in effect for the duration of the RESUBMITs
30     env_batch = case.get_env("batch")
31     if resubmit:
32         if env_batch.get_batch_system_type() == "none":
33             no_batch = True
34 
35         # This is a resubmission, do not reinitialize test values
36         if job == "case.test":
37             case.set_value("IS_FIRST_RUN", False)
38 
39         resub = case.get_value("RESUBMIT")
40         logger.info("Submitting job '{}', resubmit={:d}".format(job, resub))
41         case.set_value("RESUBMIT", resub-1)
42         if case.get_value("RESUBMIT_SETS_CONTINUE_RUN"):
43             case.set_value("CONTINUE_RUN", True)
44 
45     else:
46         if job == "case.test":
47             case.set_value("IS_FIRST_RUN", True)
48 
49         if no_batch:
50             batch_system = "none"
51         else:
52             batch_system = env_batch.get_batch_system_type()
53 
54         case.set_value("BATCH_SYSTEM", batch_system)
55 
56         env_batch_has_changed = False
57         try:
58             case.check_lockedfile(os.path.basename(env_batch.filename))
59         except SystemExit:
60             env_batch_has_changed = True
61 
62         if env_batch.get_batch_system_type() != "none" and env_batch_has_changed:
63             # May need to regen batch files if user made batch setting changes (e.g. walltime, queue, etc)
64             logger.warning(\
65 """
66 env_batch.xml appears to have changed, regenerating batch scripts
67 manual edits to these file will be lost!
68 """)
69             env_batch.make_all_batch_files(case)
70 
71         unlock_file(os.path.basename(env_batch.filename))
72         lock_file(os.path.basename(env_batch.filename))
73 
74         if job == case.get_primary_job():
75             case.check_case()
76             case.check_DA_settings()
77             if case.get_value("MACH") == "mira":
78                 with open(".original_host", "w") as fd:
79                     fd.write( socket.gethostname())
80 
81     #Load Modules
82     case.load_env()
83 
84     case.flush()
85 
86     logger.warning("submit_jobs {}".format(job))
87     job_ids = case.submit_jobs(no_batch=no_batch, job=job, skip_pnl=skip_pnl,
88                                prereq=prereq, mail_user=mail_user,
89                                mail_type=mail_type, batch_args=batch_args)
90 
91     xml_jobids = []
92     for jobname, jobid in job_ids.items():
93         logger.info("Submitted job {} with id {}".format(jobname, jobid))
94         if jobid:
95             xml_jobids.append("{}:{}".format(jobname, jobid))
96 
97     xml_jobid_text = ", ".join(xml_jobids)
98     if xml_jobid_text:
99         case.set_value("JOB_IDS", xml_jobid_text)
100 
101     return xml_jobid_text
102 
103 def submit(self, job=None, no_batch=False, prereq=None, resubmit=False,
104            skip_pnl=False, mail_user=None, mail_type=None, batch_args=None):
105     if self.get_value("TEST"):
106         caseroot = self.get_value("CASEROOT")
107         casebaseid = self.get_value("CASEBASEID")
108         # This should take care of the race condition where the submitted job
109         # begins immediately and tries to set RUN phase. We proactively assume
110         # a passed SUBMIT phase. If this state is already PASS, don't set it again
111         # because then we'll lose RUN phase info if it's there. This info is important
112         # for system_tests_common to know if it needs to reinitialize the test or not.
113         with TestStatus(test_dir=caseroot, test_name=casebaseid) as ts:
114             phase_status = ts.get_status(SUBMIT_PHASE)
115             if phase_status != TEST_PASS_STATUS:
116                 ts.set_status(SUBMIT_PHASE, TEST_PASS_STATUS)
117 
118     try:
119         functor = lambda: _submit(self, job=job, no_batch=no_batch, prereq=prereq,
120                                   resubmit=resubmit, skip_pnl=skip_pnl,
121                                   mail_user=mail_user, mail_type=mail_type,
122                                   batch_args=batch_args)
123         run_and_log_case_status(functor, "case.submit", caseroot=self.get_value("CASEROOT"),
124                                 custom_success_msg_functor=verbatim_success_msg)
125     except:
126         # If something failed in the batch system, make sure to mark
127         # the test as failed if we are running a test.
128         if self.get_value("TEST"):
129             with TestStatus(test_dir=caseroot, test_name=casebaseid) as ts:
130                 ts.set_status(SUBMIT_PHASE, TEST_FAIL_STATUS)
131 
132         raise
133 
134 def check_case(self):
135     self.check_lockedfiles()
136     self.create_namelists() # Must be called before check_all_input_data
137     logger.info("Checking that inputdata is available as part of case submission")
138     self.check_all_input_data()
139 
140     expect(self.get_value("BUILD_COMPLETE"), "Build complete is "
141            "not True please rebuild the model by calling case.build")
142     logger.info("Check case OK")
143 
144 def check_DA_settings(self):
145     script = self.get_value("DATA_ASSIMILATION_SCRIPT")
146     cycles = self.get_value("DATA_ASSIMILATION_CYCLES")
147     if len(script) > 0 and os.path.isfile(script) and cycles > 0:
148         logger.info("Data Assimilation enabled using script {} with {:d} cycles".format(script,cycles))
149
```
--- 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/case/case_submit.py b/scripts/lib/CIME/case/case_submit.py
--- a/scripts/lib/CIME/case/case_submit.py
+++ b/scripts/lib/CIME/case/case_submit.py
@@ -7,6 +7,7 @@
 submit, check_case and check_da_settings are members of class Case in file case.py
 """
 import socket
+from six.moves                   import configparser
 from CIME.XML.standard_module_setup import *
 from CIME.utils                     import expect, run_and_log_case_status, verbatim_success_msg
 from CIME.locked_files              import unlock_file, lock_file
@@ -115,12 +116,28 @@
             if phase_status != TEST_PASS_STATUS:
                 ts.set_status(SUBMIT_PHASE, TEST_PASS_STATUS)
 
+    # If this is a resubmit check the hidden file .submit_options for
+    # any submit options used on the original submit and use them again
+    caseroot = self.get_value("CASEROOT")
+    submit_options = os.path.join(caseroot, ".submit_options")
+    if resubmit and os.path.exists(submit_options):
+        config = configparser.SafeConfigParser()
+        config.read(submit_options)
+        if not skip_pnl and config.has_option('SubmitOptions','skip_pnl'):
+            skip_pnl = config.getboolean('SubmitOptions', 'skip_pnl')
+        if mail_user is None and config.has_option('SubmitOptions', 'mail_user'):
+            mail_user = config.get('SubmitOptions', 'mail_user')
+        if mail_type is None and config.has_option('SubmitOptions', 'mail_type'):
+            mail_type = config.get('SubmitOptions', 'mail_type').split(',')
+        if batch_args is None and config.has_option('SubmitOptions', 'batch_args'):
+            batch_args = config.get('SubmitOptions', 'batch_args')
+
     try:
         functor = lambda: _submit(self, job=job, no_batch=no_batch, prereq=prereq,
                                   resubmit=resubmit, skip_pnl=skip_pnl,
                                   mail_user=mail_user, mail_type=mail_type,
                                   batch_args=batch_args)
-        run_and_log_case_status(functor, "case.submit", caseroot=self.get_value("CASEROOT"),
+        run_and_log_case_status(functor, "case.submit", caseroot=caseroot,
                                 custom_success_msg_functor=verbatim_success_msg)
     except:
         # If something failed in the batch system, make sure to mark

{"golden_diff": "diff --git a/scripts/lib/CIME/case/case_submit.py b/scripts/lib/CIME/case/case_submit.py\n--- a/scripts/lib/CIME/case/case_submit.py\n+++ b/scripts/lib/CIME/case/case_submit.py\n@@ -7,6 +7,7 @@\n submit, check_case and check_da_settings are members of class Case in file case.py\n \"\"\"\n import socket\n+from six.moves                   import configparser\n from CIME.XML.standard_module_setup import *\n from CIME.utils                     import expect, run_and_log_case_status, verbatim_success_msg\n from CIME.locked_files              import unlock_file, lock_file\n@@ -115,12 +116,28 @@\n             if phase_status != TEST_PASS_STATUS:\n                 ts.set_status(SUBMIT_PHASE, TEST_PASS_STATUS)\n \n+    # If this is a resubmit check the hidden file .submit_options for\n+    # any submit options used on the original submit and use them again\n+    caseroot = self.get_value(\"CASEROOT\")\n+    submit_options = os.path.join(caseroot, \".submit_options\")\n+    if resubmit and os.path.exists(submit_options):\n+        config = configparser.SafeConfigParser()\n+        config.read(submit_options)\n+        if not skip_pnl and config.has_option('SubmitOptions','skip_pnl'):\n+            skip_pnl = config.getboolean('SubmitOptions', 'skip_pnl')\n+        if mail_user is None and config.has_option('SubmitOptions', 'mail_user'):\n+            mail_user = config.get('SubmitOptions', 'mail_user')\n+        if mail_type is None and config.has_option('SubmitOptions', 'mail_type'):\n+            mail_type = config.get('SubmitOptions', 'mail_type').split(',')\n+        if batch_args is None and config.has_option('SubmitOptions', 'batch_args'):\n+            batch_args = config.get('SubmitOptions', 'batch_args')\n+\n     try:\n         functor = lambda: _submit(self, job=job, no_batch=no_batch, prereq=prereq,\n                                   resubmit=resubmit, skip_pnl=skip_pnl,\n                                   mail_user=mail_user, mail_type=mail_type,\n                                   batch_args=batch_args)\n-        run_and_log_case_status(functor, \"case.submit\", caseroot=self.get_value(\"CASEROOT\"),\n+        run_and_log_case_status(functor, \"case.submit\", caseroot=caseroot,\n                                 custom_success_msg_functor=verbatim_success_msg)\n     except:\n         # If something failed in the batch system, make sure to mark\n", "issue": "notification options not preserved on resubmit\n... got emails regarding a job I submitted via case.submit, had RESUBMIT=1, and I didn't get emails from the resubmission. \n", "before_files": [{"content": "#!/usr/bin/env python\n\n\"\"\"\ncase.submit - Submit a cesm workflow to the queueing system or run it\nif there is no queueing system.  A cesm workflow may include multiple\njobs.\nsubmit, check_case and check_da_settings are members of class Case in file case.py\n\"\"\"\nimport socket\nfrom CIME.XML.standard_module_setup import *\nfrom CIME.utils                     import expect, run_and_log_case_status, verbatim_success_msg\nfrom CIME.locked_files              import unlock_file, lock_file\nfrom CIME.test_status               import *\n\nlogger = logging.getLogger(__name__)\n\ndef _submit(case, job=None, no_batch=False, prereq=None, resubmit=False,\n            skip_pnl=False, mail_user=None, mail_type=None, batch_args=None):\n    if job is None:\n        job = case.get_primary_job()\n\n    rundir = case.get_value(\"RUNDIR\")\n    if job != \"case.test\":\n        continue_run = case.get_value(\"CONTINUE_RUN\")\n        expect(os.path.isdir(rundir) or not continue_run,\n               \" CONTINUE_RUN is true but RUNDIR {} does not exist\".format(rundir))\n\n    # if case.submit is called with the no_batch flag then we assume that this\n    # flag will stay in effect for the duration of the RESUBMITs\n    env_batch = case.get_env(\"batch\")\n    if resubmit:\n        if env_batch.get_batch_system_type() == \"none\":\n            no_batch = True\n\n        # This is a resubmission, do not reinitialize test values\n        if job == \"case.test\":\n            case.set_value(\"IS_FIRST_RUN\", False)\n\n        resub = case.get_value(\"RESUBMIT\")\n        logger.info(\"Submitting job '{}', resubmit={:d}\".format(job, resub))\n        case.set_value(\"RESUBMIT\", resub-1)\n        if case.get_value(\"RESUBMIT_SETS_CONTINUE_RUN\"):\n            case.set_value(\"CONTINUE_RUN\", True)\n\n    else:\n        if job == \"case.test\":\n            case.set_value(\"IS_FIRST_RUN\", True)\n\n        if no_batch:\n            batch_system = \"none\"\n        else:\n            batch_system = env_batch.get_batch_system_type()\n\n        case.set_value(\"BATCH_SYSTEM\", batch_system)\n\n        env_batch_has_changed = False\n        try:\n            case.check_lockedfile(os.path.basename(env_batch.filename))\n        except SystemExit:\n            env_batch_has_changed = True\n\n        if env_batch.get_batch_system_type() != \"none\" and env_batch_has_changed:\n            # May need to regen batch files if user made batch setting changes (e.g. walltime, queue, etc)\n            logger.warning(\\\n\"\"\"\nenv_batch.xml appears to have changed, regenerating batch scripts\nmanual edits to these file will be lost!\n\"\"\")\n            env_batch.make_all_batch_files(case)\n\n        unlock_file(os.path.basename(env_batch.filename))\n        lock_file(os.path.basename(env_batch.filename))\n\n        if job == case.get_primary_job():\n            case.check_case()\n            case.check_DA_settings()\n            if case.get_value(\"MACH\") == \"mira\":\n                with open(\".original_host\", \"w\") as fd:\n                    fd.write( socket.gethostname())\n\n    #Load Modules\n    case.load_env()\n\n    case.flush()\n\n    logger.warning(\"submit_jobs {}\".format(job))\n    job_ids = case.submit_jobs(no_batch=no_batch, job=job, skip_pnl=skip_pnl,\n                               prereq=prereq, mail_user=mail_user,\n                               mail_type=mail_type, batch_args=batch_args)\n\n    xml_jobids = []\n    for jobname, jobid in job_ids.items():\n        logger.info(\"Submitted job {} with id {}\".format(jobname, jobid))\n        if jobid:\n            xml_jobids.append(\"{}:{}\".format(jobname, jobid))\n\n    xml_jobid_text = \", \".join(xml_jobids)\n    if xml_jobid_text:\n        case.set_value(\"JOB_IDS\", xml_jobid_text)\n\n    return xml_jobid_text\n\ndef submit(self, job=None, no_batch=False, prereq=None, resubmit=False,\n           skip_pnl=False, mail_user=None, mail_type=None, batch_args=None):\n    if self.get_value(\"TEST\"):\n        caseroot = self.get_value(\"CASEROOT\")\n        casebaseid = self.get_value(\"CASEBASEID\")\n        # This should take care of the race condition where the submitted job\n        # begins immediately and tries to set RUN phase. We proactively assume\n        # a passed SUBMIT phase. If this state is already PASS, don't set it again\n        # because then we'll lose RUN phase info if it's there. This info is important\n        # for system_tests_common to know if it needs to reinitialize the test or not.\n        with TestStatus(test_dir=caseroot, test_name=casebaseid) as ts:\n            phase_status = ts.get_status(SUBMIT_PHASE)\n            if phase_status != TEST_PASS_STATUS:\n                ts.set_status(SUBMIT_PHASE, TEST_PASS_STATUS)\n\n    try:\n        functor = lambda: _submit(self, job=job, no_batch=no_batch, prereq=prereq,\n                                  resubmit=resubmit, skip_pnl=skip_pnl,\n                                  mail_user=mail_user, mail_type=mail_type,\n                                  batch_args=batch_args)\n        run_and_log_case_status(functor, \"case.submit\", caseroot=self.get_value(\"CASEROOT\"),\n                                custom_success_msg_functor=verbatim_success_msg)\n    except:\n        # If something failed in the batch system, make sure to mark\n        # the test as failed if we are running a test.\n        if self.get_value(\"TEST\"):\n            with TestStatus(test_dir=caseroot, test_name=casebaseid) as ts:\n                ts.set_status(SUBMIT_PHASE, TEST_FAIL_STATUS)\n\n        raise\n\ndef check_case(self):\n    self.check_lockedfiles()\n    self.create_namelists() # Must be called before check_all_input_data\n    logger.info(\"Checking that inputdata is available as part of case submission\")\n    self.check_all_input_data()\n\n    expect(self.get_value(\"BUILD_COMPLETE\"), \"Build complete is \"\n           \"not True please rebuild the model by calling case.build\")\n    logger.info(\"Check case OK\")\n\ndef check_DA_settings(self):\n    script = self.get_value(\"DATA_ASSIMILATION_SCRIPT\")\n    cycles = self.get_value(\"DATA_ASSIMILATION_CYCLES\")\n    if len(script) > 0 and os.path.isfile(script) and cycles > 0:\n        logger.info(\"Data Assimilation enabled using script {} with {:d} cycles\".format(script,cycles))\n", "path": "scripts/lib/CIME/case/case_submit.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\n\"\"\"\ncase.submit - Submit a cesm workflow to the queueing system or run it\nif there is no queueing system.  A cesm workflow may include multiple\njobs.\nsubmit, check_case and check_da_settings are members of class Case in file case.py\n\"\"\"\nimport socket\nfrom six.moves                   import configparser\nfrom CIME.XML.standard_module_setup import *\nfrom CIME.utils                     import expect, run_and_log_case_status, verbatim_success_msg\nfrom CIME.locked_files              import unlock_file, lock_file\nfrom CIME.test_status               import *\n\nlogger = logging.getLogger(__name__)\n\ndef _submit(case, job=None, no_batch=False, prereq=None, resubmit=False,\n            skip_pnl=False, mail_user=None, mail_type=None, batch_args=None):\n    if job is None:\n        job = case.get_primary_job()\n\n    rundir = case.get_value(\"RUNDIR\")\n    if job != \"case.test\":\n        continue_run = case.get_value(\"CONTINUE_RUN\")\n        expect(os.path.isdir(rundir) or not continue_run,\n               \" CONTINUE_RUN is true but RUNDIR {} does not exist\".format(rundir))\n\n    # if case.submit is called with the no_batch flag then we assume that this\n    # flag will stay in effect for the duration of the RESUBMITs\n    env_batch = case.get_env(\"batch\")\n    if resubmit:\n        if env_batch.get_batch_system_type() == \"none\":\n            no_batch = True\n\n        # This is a resubmission, do not reinitialize test values\n        if job == \"case.test\":\n            case.set_value(\"IS_FIRST_RUN\", False)\n\n        resub = case.get_value(\"RESUBMIT\")\n        logger.info(\"Submitting job '{}', resubmit={:d}\".format(job, resub))\n        case.set_value(\"RESUBMIT\", resub-1)\n        if case.get_value(\"RESUBMIT_SETS_CONTINUE_RUN\"):\n            case.set_value(\"CONTINUE_RUN\", True)\n\n    else:\n        if job == \"case.test\":\n            case.set_value(\"IS_FIRST_RUN\", True)\n\n        if no_batch:\n            batch_system = \"none\"\n        else:\n            batch_system = env_batch.get_batch_system_type()\n\n        case.set_value(\"BATCH_SYSTEM\", batch_system)\n\n        env_batch_has_changed = False\n        try:\n            case.check_lockedfile(os.path.basename(env_batch.filename))\n        except SystemExit:\n            env_batch_has_changed = True\n\n        if env_batch.get_batch_system_type() != \"none\" and env_batch_has_changed:\n            # May need to regen batch files if user made batch setting changes (e.g. walltime, queue, etc)\n            logger.warning(\\\n\"\"\"\nenv_batch.xml appears to have changed, regenerating batch scripts\nmanual edits to these file will be lost!\n\"\"\")\n            env_batch.make_all_batch_files(case)\n\n        unlock_file(os.path.basename(env_batch.filename))\n        lock_file(os.path.basename(env_batch.filename))\n\n        if job == case.get_primary_job():\n            case.check_case()\n            case.check_DA_settings()\n            if case.get_value(\"MACH\") == \"mira\":\n                with open(\".original_host\", \"w\") as fd:\n                    fd.write( socket.gethostname())\n\n    #Load Modules\n    case.load_env()\n\n    case.flush()\n\n    logger.warning(\"submit_jobs {}\".format(job))\n    job_ids = case.submit_jobs(no_batch=no_batch, job=job, skip_pnl=skip_pnl,\n                               prereq=prereq, mail_user=mail_user,\n                               mail_type=mail_type, batch_args=batch_args)\n\n    xml_jobids = []\n    for jobname, jobid in job_ids.items():\n        logger.info(\"Submitted job {} with id {}\".format(jobname, jobid))\n        if jobid:\n            xml_jobids.append(\"{}:{}\".format(jobname, jobid))\n\n    xml_jobid_text = \", \".join(xml_jobids)\n    if xml_jobid_text:\n        case.set_value(\"JOB_IDS\", xml_jobid_text)\n\n    return xml_jobid_text\n\ndef submit(self, job=None, no_batch=False, prereq=None, resubmit=False,\n           skip_pnl=False, mail_user=None, mail_type=None, batch_args=None):\n    if self.get_value(\"TEST\"):\n        caseroot = self.get_value(\"CASEROOT\")\n        casebaseid = self.get_value(\"CASEBASEID\")\n        # This should take care of the race condition where the submitted job\n        # begins immediately and tries to set RUN phase. We proactively assume\n        # a passed SUBMIT phase. If this state is already PASS, don't set it again\n        # because then we'll lose RUN phase info if it's there. This info is important\n        # for system_tests_common to know if it needs to reinitialize the test or not.\n        with TestStatus(test_dir=caseroot, test_name=casebaseid) as ts:\n            phase_status = ts.get_status(SUBMIT_PHASE)\n            if phase_status != TEST_PASS_STATUS:\n                ts.set_status(SUBMIT_PHASE, TEST_PASS_STATUS)\n\n    # If this is a resubmit check the hidden file .submit_options for\n    # any submit options used on the original submit and use them again\n    caseroot = self.get_value(\"CASEROOT\")\n    submit_options = os.path.join(caseroot, \".submit_options\")\n    if resubmit and os.path.exists(submit_options):\n        config = configparser.SafeConfigParser()\n        config.read(submit_options)\n        if not skip_pnl and config.has_option('SubmitOptions','skip_pnl'):\n            skip_pnl = config.getboolean('SubmitOptions', 'skip_pnl')\n        if mail_user is None and config.has_option('SubmitOptions', 'mail_user'):\n            mail_user = config.get('SubmitOptions', 'mail_user')\n        if mail_type is None and config.has_option('SubmitOptions', 'mail_type'):\n            mail_type = config.get('SubmitOptions', 'mail_type').split(',')\n        if batch_args is None and config.has_option('SubmitOptions', 'batch_args'):\n            batch_args = config.get('SubmitOptions', 'batch_args')\n\n    try:\n        functor = lambda: _submit(self, job=job, no_batch=no_batch, prereq=prereq,\n                                  resubmit=resubmit, skip_pnl=skip_pnl,\n                                  mail_user=mail_user, mail_type=mail_type,\n                                  batch_args=batch_args)\n        run_and_log_case_status(functor, \"case.submit\", caseroot=caseroot,\n                                custom_success_msg_functor=verbatim_success_msg)\n    except:\n        # If something failed in the batch system, make sure to mark\n        # the test as failed if we are running a test.\n        if self.get_value(\"TEST\"):\n            with TestStatus(test_dir=caseroot, test_name=casebaseid) as ts:\n                ts.set_status(SUBMIT_PHASE, TEST_FAIL_STATUS)\n\n        raise\n\ndef check_case(self):\n    self.check_lockedfiles()\n    self.create_namelists() # Must be called before check_all_input_data\n    logger.info(\"Checking that inputdata is available as part of case submission\")\n    self.check_all_input_data()\n\n    expect(self.get_value(\"BUILD_COMPLETE\"), \"Build complete is \"\n           \"not True please rebuild the model by calling case.build\")\n    logger.info(\"Check case OK\")\n\ndef check_DA_settings(self):\n    script = self.get_value(\"DATA_ASSIMILATION_SCRIPT\")\n    cycles = self.get_value(\"DATA_ASSIMILATION_CYCLES\")\n    if len(script) > 0 and os.path.isfile(script) and cycles > 0:\n        logger.info(\"Data Assimilation enabled using script {} with {:d} cycles\".format(script,cycles))\n", "path": "scripts/lib/CIME/case/case_submit.py"}]}