internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: ESMCI/cime

Issue:
continue_run check in case_submit does not account for multidriver cases 
case_submit.py looks for a rpointer.drv file but not rpointer.drv_xxxx


Discussion:

Resolving patch:
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
@@ -34,11 +34,16 @@ def _submit(case, job=None, no_batch=False, prereq=None, allow_fail=False, resub
         rundir = case.get_value("RUNDIR")
         expect(os.path.isdir(rundir),
                "CONTINUE_RUN is true but RUNDIR {} does not exist".format(rundir))
-        expect(os.path.exists(os.path.join(rundir,"rpointer.drv")),
+        # only checks for the first instance in a multidriver case
+        if case.get_value("MULTI_DRIVER"):
+            rpointer = "rpointer.drv_0001"
+        else:
+            rpointer = "rpointer.drv"
+        expect(os.path.exists(os.path.join(rundir,rpointer)),
                "CONTINUE_RUN is true but this case does not appear to have restart files staged in {}".format(rundir))
         # Finally we open the rpointer.drv file and check that it's correct
         casename = case.get_value("CASE")
-        with open(os.path.join(rundir,"rpointer.drv"), "r") as fd:
+        with open(os.path.join(rundir,rpointer), "r") as fd:
             ncfile = fd.readline().strip()
             expect(ncfile.startswith(casename) and
                    os.path.exists(os.path.join(rundir,ncfile)),


Test patch:
Repository: ESMCI/cime

Issue:
GET_REFCASE error reporting 
If GET_REFCASE=TRUE but the refcase directory is invalid no error is reported until runtime. 


Discussion:

Resolving patch:
diff --git a/scripts/lib/CIME/case/check_input_data.py b/scripts/lib/CIME/case/check_input_data.py
--- a/scripts/lib/CIME/case/check_input_data.py
+++ b/scripts/lib/CIME/case/check_input_data.py
@@ -208,6 +208,8 @@ def stage_refcase(self, input_data_root=None, data_list_dir=None):
 
         if os.path.isabs(run_refdir):
             refdir = run_refdir
+            expect(os.path.isdir(refdir), "Reference case directory {} does not exist or is not readable".format(refdir))
+
         else:
             refdir = os.path.join(din_loc_root, run_refdir, run_refcase, run_refdate)
             if not os.path.isdir(refdir):
@@ -228,12 +230,12 @@ def stage_refcase(self, input_data_root=None, data_list_dir=None):
         if (not os.path.exists(rundir)):
             logger.debug("Creating run directory: {}".format(rundir))
             os.makedirs(rundir)
-
+        rpointerfile = None
         # copy the refcases' rpointer files to the run directory
         for rpointerfile in glob.iglob(os.path.join("{}","*rpointer*").format(refdir)):
             logger.info("Copy rpointer {}".format(rpointerfile))
             safe_copy(rpointerfile, rundir)
-
+        expect(rpointerfile,"Reference case directory {} does not contain any rpointer files".format(refdir))
         # link everything else
 
         for rcfile in glob.iglob(os.path.join(refdir,"*")):


Test patch:
Repository: ESMCI/cime

Issue:
--machine command line argument no longer honored
#3099 introduced optional arguments, but in fact they are currently required. 
```
CIME_MODEL=cesm ./create_test SMS.f19_g17.X.centos7-linux_gnu
Testnames: ['SMS.f19_g17.X.centos7-linux_gnu']
No project info available
Creating test directory /home/jedwards/cesm/scratch/SMS.f19_g17.X.centos7-linux_gnu.20190508_083823_v67fbz
RUNNING TESTS:
  SMS.f19_g17.X.centos7-linux_gnu
Starting CREATE_NEWCASE for test SMS.f19_g17.X.centos7-linux_gnu with 1 procs
Finished CREATE_NEWCASE for test SMS.f19_g17.X.centos7-linux_gnu in 1.197116 seconds (FAIL). [COMPLETED 1 of 1]
    Case dir: /home/jedwards/cesm/scratch/SMS.f19_g17.X.centos7-linux_gnu.20190508_083823_v67fbz
    Errors were:
        WARNING: User-selected machine 'centos7-linux' does not match probed machine 'congo'
        WARNING: No cesm Model version found.
```


Discussion:

Resolving patch:
diff --git a/scripts/lib/CIME/XML/env_mach_specific.py b/scripts/lib/CIME/XML/env_mach_specific.py
--- a/scripts/lib/CIME/XML/env_mach_specific.py
+++ b/scripts/lib/CIME/XML/env_mach_specific.py
@@ -452,7 +452,7 @@ def get_mpirun(self, case, attribs, job, exe_only=False):
 
         # if there are no special arguments required for mpi-serial it need not have an entry in config_machines.xml
         if "mpilib" in attribs and attribs["mpilib"] == "mpi-serial" and best_match is None:
-            return "",[]
+            return "",[],None,None
 
         expect(best_match is not None or default_match is not None,
                "Could not find a matching MPI for attributes: {}".format(attribs))
@@ -474,12 +474,16 @@ def get_mpirun(self, case, attribs, job, exe_only=False):
         exec_node = self.get_child("executable", root=the_match)
         expect(exec_node is not None,"No executable found")
         executable = self.text(exec_node)
+        run_exe = None
+        run_misc_suffix = None
 
         run_exe_node = self.get_optional_child('run_exe', root=the_match)
-        run_exe = self.text(run_exe_node)
+        if run_exe_node:
+            run_exe = self.text(run_exe_node)
 
         run_misc_suffix_node = self.get_optional_child('run_misc_suffix', root=the_match)
-        run_misc_suffix = self.text(run_misc_suffix_node)
+        if run_misc_suffix_node:
+            run_misc_suffix = self.text(run_misc_suffix_node)
 
         return executable, args, run_exe, run_misc_suffix
 


Test patch:
Repository: ESMCI/cime

Issue:
Tested compsets category too narrow
Currently, a compset -- grid combination is considered supported if it is tested in certain test categories such as prealpha, prebeta, or aux_*. test_release is omitted from that list.
Is this on purpose? If so, why? If not, can we add test_release to the list?


Discussion:
Test case which I think should work:

`./create_newcase --case supportme --compset FTJ16 --res f09_f09_mg17`
The code is here https://github.com/ESMCI/cime/blob/maint-5.6/scripts/lib/CIME/case/case.py#L1328
this is the list agreed to by software liaisons.   test_release is not a category I was even aware existed - did your liaison bring this to cseg members as a category that should be added to the list of those tested and supported? 
I know what the code says (which is where I got the list in my original message since I could not find this in the CIME documentation).
This issue was reported by a user who was surprised that a tested compset -- grid combination is still not considered supported.
If you feel that test_release does not qualify as support, then please document what does qualify (or point me to the documentation I missed).
If it does qualify, can we add it to the list? 
Again - I defer to the cam group and the cam software liaison who were the ones who imposed this entire idea of supported and tested compsets. 

Resolving patch:
diff --git a/scripts/lib/CIME/case/case.py b/scripts/lib/CIME/case/case.py
--- a/scripts/lib/CIME/case/case.py
+++ b/scripts/lib/CIME/case/case.py
@@ -1324,8 +1324,9 @@ def _check_testlists(self, compset_alias, grid_name, files):
             #   called if run_unsupported is False.
             tests = Testlist(tests_spec_file, files)
             testlist = tests.get_tests(compset=compset_alias, grid=grid_name, supported_only=True)
+            test_categories = ["prealpha", "prebeta", "test_release"]
             for test in testlist:
-                if test["category"] == "prealpha" or test["category"] == "prebeta" or "aux_" in test["category"]:
+                if test["category"] in test_categories or "aux_" in test["category"]:
                     testcnt += 1
         if testcnt > 0:
             logger.warning("\n*********************************************************************************************************************************")


Test patch:
Repository: ESMCI/cime

Issue:
Setting --output-root ${CASEDIR} and --case ${CASEDIR}/${CASENAME} results in MCT build error as of 5.8.0 on Cheyenne
Not sure if this is desired or not, but figured I'd note it.

Previously, when doing dev work w/ CAM/CESM I set:
--case ${CASEDIR}/${CASENAME} --output-root ${CASEDIR}

... during the create_newcase phase so I could have "self-contained" directories on my scratch space for playing around in (rather than splitting them between home/scratch like I normally do for production runs)

This seems to be acceptable up until cesm2_2_beta01 (CIME 5.7.x)...

As of cesm2_2_beta02 (>=CIME 5.8) this setup results in an error when building mct libraries...

```
/glade/u/home/zarzycki/scratch/TC_PBL/ne30test/Tools/mkSrcfiles
cp -f Filepath Deppath
/glade/u/home/zarzycki/scratch/TC_PBL/ne30test/Tools/mkDepends  Deppath Srcfiles > Depends
gmake: Leaving directory '/glade/scratch/zarzycki/TC_PBL/ne30test/bld/intel/mpt/nodebug/nothreads/mct/mct'
cat: Filepath: No such file or directory
cat: Srcfiles: No such file or directory
gmake: *** No rule to make target '/glade/u/home/zarzycki/scratch/TC_PBL/ne30test/bld/intel/mpt/nodebug/nothreads/mct/mct/Makefile.conf'.  Stop.
ERROR: cat: Filepath: No such file or directory
cat: Srcfiles: No such file or directory
gmake: *** No rule to make target '/glade/u/home/zarzycki/scratch/TC_PBL/ne30test/bld/intel/mpt/nodebug/nothreads/mct/mct/Makefile.conf'.  Stop.
```

The way to get around this (for me) is to have the --output_root be external to the case dir, this seems to allow MCT to build fine and the rest of the components to proceed as expected. Given this, I assume there is some relative path issue with ../ or similar?

This can be easily reproduced on Cheyenne w/ default sys modules by checking out cesm2_2_beta02, configuring a generic F compset, and running ./case.setup, ./case.build.


Discussion:
@zarzycki - thanks for the report - I will submit a PR to fix, I believe that if you do not add a trailing / to --output-root it will work correctly.  That is do:
```
./create_newcase --case /glade/scratch/jedwards/cesmtests/foo2 --output-root /glade/scratch/jedwards/cesmtests --compset X --res f19_g17 --run-unsupported
```
not
```
./create_newcase --case /glade/scratch/jedwards/cesmtests/foo2 --output-root /glade/scratch/jedwards/cesmtests/ --compset X --res f19_g17 --run-unsupported
```


Resolving patch:
diff --git a/scripts/lib/CIME/case/case.py b/scripts/lib/CIME/case/case.py
--- a/scripts/lib/CIME/case/case.py
+++ b/scripts/lib/CIME/case/case.py
@@ -1021,6 +1021,7 @@ def configure(self, compset_name, grid_name, machine_name=None,
         # we don't want to resolve variables until we need them
         if output_root is None:
             output_root = self.get_value("CIME_OUTPUT_ROOT")
+        output_root = os.path.abspath(output_root)
         self.set_value("CIME_OUTPUT_ROOT", output_root)
         if non_local:
             self.set_value("EXEROOT", os.path.join(output_root, self.get_value("CASE"), "bld"))


Test patch:
Repository: ESMCI/cime

Issue:
better error reporting for refcase errors
Improve reporting of invalid settings in REFCASE when GET_REFCASE=TRUE
Test suite: scripts_regression_tests.py, by hand
Test baseline: 
Test namelist changes: 
Test status: bit for bit
Fixes #3094 

User interface changes?: 

Update gh-pages html (Y/N)?:

Code review: 



Discussion:

Resolving patch:
diff --git a/scripts/lib/CIME/build.py b/scripts/lib/CIME/build.py
--- a/scripts/lib/CIME/build.py
+++ b/scripts/lib/CIME/build.py
@@ -34,6 +34,9 @@ def get_standard_cmake_args(case, shared_lib=False):
     for var in _CMD_ARGS_FOR_BUILD:
         cmake_args += xml_to_make_variable(case, var, cmake=True)
 
+    # Disable compiler checks
+    cmake_args += " -DCMAKE_C_COMPILER_WORKS=1 -DCMAKE_CXX_COMPILER_WORKS=1 -DCMAKE_Fortran_COMPILER_WORKS=1"
+
     return cmake_args
 
 def xml_to_make_variable(case, varname, cmake=False):


Test patch:
diff --git a/config/e3sm/tests.py b/config/e3sm/tests.py
--- a/config/e3sm/tests.py
+++ b/config/e3sm/tests.py
@@ -217,6 +217,8 @@
                  "SMS.ne4_ne4.FC5AV1C-L.cam-thetanh_ftype2",
                  "SMS.ne4_ne4.FC5AV1C-L.cam-thetanh_ftype4",
                  "SMS.ne4_ne4.FC5AV1C-L.cam-thetahy_sl",
+                 "ERS.ne4_ne4.FC5AV1C-L.cam-thetahy_ftype2",
+                 "ERS.ne4_ne4.FC5AV1C-L.cam-thetanh_ftype2",
                  )
     },
Repository: ESMCI/cime

Issue:
If stream filename is full path use it to set filepath
Related to issue #1903 

./create_newcase --case ../../cases/QPC6_c201_userSSTtest --compset QPC6 --res f09_f09_mg17 --project UMAI0021 --run-unsupported
cd ../../cases/QPC6_c201_userSSTtest/
./case.setup
./xmlchange DOCN_MODE="sst_aquapfile"
./xmlchange DOCN_AQP_FILENAME="/glade/u/home/benedict/ys/datain/SST_ICE_zonalAsymQOBS_fv0.9x1.25_allSeas_clim_1982-2011.nc"

~ ~ ~ The error:  Even before building, you can run ./preview_namelists to set the inputs in $CASEROOT/CaseDocs.  When you do this, you can see a problem in file $CASEROOT/CaseDocs/docn.streams.txt.aquapfile:
<filePath> /glade/p/cesmdata/cseg/inputdata/ocn/docn7/AQUAPLANET/
<fileNames> /glade/u/home/benedict/ys/datain/SST_ICE_zonalAsymQOBS_fv0.9x1.25_allSeas_clim_1982-2011.nc



Discussion:

Resolving patch:
diff --git a/scripts/lib/CIME/nmlgen.py b/scripts/lib/CIME/nmlgen.py
--- a/scripts/lib/CIME/nmlgen.py
+++ b/scripts/lib/CIME/nmlgen.py
@@ -474,7 +474,9 @@ def create_stream_file_and_update_shr_strdata_nml(self, config, #pylint:disable=
             for i, filename in enumerate(domain_filenames.split("\n")):
                 if filename.strip() == '':
                     continue
-                filepath = os.path.join(domain_filepath, filename.strip())
+                filepath, filename = os.path.split(filename)
+                if not filepath:
+                    filepath = os.path.join(domain_filepath, os.path.dirname(filename.strip()))
                 string = "domain{:d} = {}\n".format(i+1, filepath)
                 hashValue = hashlib.md5(string.rstrip().encode('utf-8')).hexdigest()
                 if hashValue not in lines_hash:


Test patch:
Repository: ESMCI/cime

Issue:
workflow issue 
Workflow jobs intended to run prior to case.run or case.test do not currently enter the workflow, I think that this is due to the case.submit script always initiating with case.run or case.test.   


Discussion:

Resolving patch:
diff --git a/scripts/lib/CIME/XML/env_batch.py b/scripts/lib/CIME/XML/env_batch.py
--- a/scripts/lib/CIME/XML/env_batch.py
+++ b/scripts/lib/CIME/XML/env_batch.py
@@ -435,6 +435,7 @@ def submit_jobs(self, case, no_batch=False, job=None, user_prereq=None, skip_pnl
         alljobs = env_workflow.get_jobs()
         alljobs = [j for j in alljobs
                    if os.path.isfile(os.path.join(self._caseroot,get_batch_script_for_job(j)))]
+
         startindex = 0
         jobs = []
         firstjob = job
@@ -459,6 +460,7 @@ def submit_jobs(self, case, no_batch=False, job=None, user_prereq=None, skip_pnl
 
             if self._batchtype == "cobalt":
                 break
+
         depid = OrderedDict()
         jobcmds = []
 
diff --git a/scripts/lib/CIME/case/case.py b/scripts/lib/CIME/case/case.py
--- a/scripts/lib/CIME/case/case.py
+++ b/scripts/lib/CIME/case/case.py
@@ -1484,3 +1484,8 @@ def is_save_timing_dir_project(self,project):
 
     def get_primary_job(self):
         return "case.test" if self.get_value("TEST") else "case.run"
+
+    def get_first_job(self):
+        env_workflow = self.get_env("workflow")
+        jobs = env_workflow.get_jobs()
+        return jobs[0]
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
@@ -26,7 +26,7 @@ def _submit(case, job=None, no_batch=False, prereq=None, allow_fail=False, resub
             resubmit_immediate=False, skip_pnl=False, mail_user=None, mail_type=None,
             batch_args=None):
     if job is None:
-        job = case.get_primary_job()
+        job = case.get_first_job()
 
     rundir = case.get_value("RUNDIR")
     if job != "case.test":


Test patch:
Repository: ESMCI/cime

Issue:
workflow issue 
Workflow jobs intended to run prior to case.run or case.test do not currently enter the workflow, I think that this is due to the case.submit script always initiating with case.run or case.test.   


Discussion:

Resolving patch:
diff --git a/scripts/lib/CIME/XML/env_batch.py b/scripts/lib/CIME/XML/env_batch.py
--- a/scripts/lib/CIME/XML/env_batch.py
+++ b/scripts/lib/CIME/XML/env_batch.py
@@ -434,6 +434,7 @@ def submit_jobs(self, case, no_batch=False, job=None, user_prereq=None, skip_pnl
         alljobs = env_workflow.get_jobs()
         alljobs = [j for j in alljobs
                    if os.path.isfile(os.path.join(self._caseroot,get_batch_script_for_job(j)))]
+
         startindex = 0
         jobs = []
         firstjob = job
@@ -458,6 +459,7 @@ def submit_jobs(self, case, no_batch=False, job=None, user_prereq=None, skip_pnl
 
             if self._batchtype == "cobalt":
                 break
+
         depid = OrderedDict()
         jobcmds = []
 
diff --git a/scripts/lib/CIME/case/case.py b/scripts/lib/CIME/case/case.py
--- a/scripts/lib/CIME/case/case.py
+++ b/scripts/lib/CIME/case/case.py
@@ -1639,3 +1639,8 @@ def is_save_timing_dir_project(self,project):
 
     def get_primary_job(self):
         return "case.test" if self.get_value("TEST") else "case.run"
+
+    def get_first_job(self):
+        env_workflow = self.get_env("workflow")
+        jobs = env_workflow.get_jobs()
+        return jobs[0]
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
@@ -27,7 +27,7 @@ def _submit(case, job=None, no_batch=False, prereq=None, allow_fail=False, resub
             resubmit_immediate=False, skip_pnl=False, mail_user=None, mail_type=None,
             batch_args=None):
     if job is None:
-        job = case.get_primary_job()
+        job = case.get_first_job()
 
     # Check if CONTINUE_RUN value makes sense
     if job != "case.test" and case.get_value("CONTINUE_RUN"):


Test patch:
Repository: ESMCI/cime

Issue:
--no-batch flag  not working.
The changes to the workflow, and env_batch.xml now being locked, is causing errors when testing with the --no-batch flag.  The AMWG is hoping to make this the default way of running the cam tests.

```
Output: found difference in BATCH_SYSTEM : case 'none' locked 'pbs'
found difference in BATCH_SYSTEM : case 'none' locked 'pbs'
ERROR: Batch configuration has changed, please run case.setup --reset`
```



Discussion:

Resolving patch:
diff --git a/scripts/lib/CIME/XML/env_batch.py b/scripts/lib/CIME/XML/env_batch.py
--- a/scripts/lib/CIME/XML/env_batch.py
+++ b/scripts/lib/CIME/XML/env_batch.py
@@ -5,7 +5,7 @@
 from CIME.XML.standard_module_setup import *
 from CIME.XML.env_base import EnvBase
 from CIME.utils import transform_vars, get_cime_root, convert_to_seconds, get_cime_config, get_batch_script_for_job, get_logging_options
-
+from CIME.locked_files import lock_file, unlock_file
 from collections import OrderedDict
 import stat, re, math
 
@@ -161,7 +161,11 @@ def set_batch_system(self, batchobj, batch_system_type=None):
             self.add_child(self.copy(batchobj.batch_system_node))
         if batchobj.machine_node is not None:
             self.add_child(self.copy(batchobj.machine_node))
+        if os.path.exists(os.path.join(self._caseroot, "LockedFiles", "env_batch.xml")):
+            unlock_file(os.path.basename(batchobj.filename), caseroot=self._caseroot)
         self.set_value("BATCH_SYSTEM", batch_system_type)
+        if os.path.exists(os.path.join(self._caseroot, "LockedFiles")):
+            lock_file(os.path.basename(batchobj.filename), caseroot=self._caseroot)
 
     def get_job_overrides(self, job, case):
         env_workflow = case.get_env('workflow')
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
@@ -62,7 +62,7 @@ def _submit(case, job=None, no_batch=False, prereq=None, allow_fail=False, resub
         batch_system = "none"
     else:
         batch_system = env_batch.get_batch_system_type()
-
+    unlock_file(os.path.basename(env_batch.filename))
     case.set_value("BATCH_SYSTEM", batch_system)
 
     env_batch_has_changed = False
@@ -80,8 +80,7 @@ def _submit(case, job=None, no_batch=False, prereq=None, allow_fail=False, resub
 manual edits to these file will be lost!
 """)
         env_batch.make_all_batch_files(case)
-
-    unlock_file(os.path.basename(env_batch.filename))
+    case.flush()
     lock_file(os.path.basename(env_batch.filename))
 
     if resubmit:


Test patch:
Repository: ESMCI/cime

Issue:
Empty .cesm_proj file results in a crash
I'm opening this issue on behalf of @JeremyFyke . He has an empty `.cesm_proj` file in his home directory on cheyenne. When he ran:

```
create_newcase \
                           --case $D/$CaseName \
                           --compset B1850G \
                           --res f09_g17_gl4 \
                           --mach cheyenne \
                           --project $ProjCode \
                           --run-unsupported
```

He got this traceback:

```
No charge_account info available, using value from PROJECT
Traceback (most recent call last):
  File "/glade/u/home/jfyke/cesm-scripts/Coupled_BG_JG_Spinup_CESM2_Production/Model_Version/cesm2.0.0/cime/scripts/create_newcase", line 218, in <module>
    _main_func(__doc__)
  File "/glade/u/home/jfyke/cesm-scripts/Coupled_BG_JG_Spinup_CESM2_Production/Model_Version/cesm2.0.0/cime/scripts/create_newcase", line 213, in _main_func
    input_dir=input_dir, driver=driver)
  File "/glade/u/cesm-scripts/liwg/Coupled_BG_JG_Spinup_CESM2_Production/Model_Version/cesm2.0.0/cime/scripts/Tools/../../scripts/lib/CIME/case/case.py", line 1431, in create
    input_dir=input_dir, driver=driver)
  File "/glade/u/cesm-scripts/liwg/Coupled_BG_JG_Spinup_CESM2_Production/Model_Version/cesm2.0.0/cime/scripts/Tools/../../scripts/lib/CIME/case/case.py", line 890, in configure
    charge_account = get_charge_account(machobj)
  File "/glade/u/cesm-scripts/liwg/Coupled_BG_JG_Spinup_CESM2_Production/Model_Version/cesm2.0.0/cime/scripts/Tools/../../scripts/lib/CIME/utils.py", line 963, in get_charge_account
    return get_project(machobj)
  File "/glade/u/cesm-scripts/liwg/Coupled_BG_JG_Spinup_CESM2_Production/Model_Version/cesm2.0.0/cime/scripts/Tools/../../scripts/lib/CIME/utils.py", line 911, in get_project
    logger.info("Using project from .cesm_proj: " + project)
TypeError: cannot concatenate 'str' and 'NoneType' objects
```

I haven't looked into this carefully, but at a glance, I'm wondering if this block of code: https://github.com/ESMCI/cime/blob/b78593b3aaeeafc56ec8239905b41820e3ab00c2/scripts/lib/CIME/utils.py#L904-L913 should have a `if project is not None` check, as the other blocks in that function do?
 


Discussion:
I think the reason this results in a crash despite his explicitly specifying `--project` is because of #2676 

Resolving patch:
diff --git a/scripts/lib/CIME/utils.py b/scripts/lib/CIME/utils.py
--- a/scripts/lib/CIME/utils.py
+++ b/scripts/lib/CIME/utils.py
@@ -966,6 +966,7 @@ def get_project(machobj=None):
                 project = line.rstrip()
                 if not project.startswith("#"):
                     break
+        if (project is not None):
             logger.info("Using project from .cesm_proj: " + project)
             cime_config.set('main','PROJECT',project)
             return project


Test patch: