Repository: ESMCI/cime

Issue:
Recent backwards-incompatibility in cime for user-defined machines
This is for discussion - in this issue and/or at our next cime telecon.

I just stumbled across a cime change that was made a few months ago that requires changes in the config_compilers.xml file that any external users maintain on their own machine: #3054 changed the compile_threaded value from lowercase ('false') to uppercase ('FALSE'). @jgfouca did a good job of calling this out in the PR description, but I wonder if we need to do more than that in the future to minimize or eliminate the burden that such changes place on external users, given that we're trying to keep cime easy to port to other machines.

I'm not quite sure what the answer is here. Ironically, this PR came in right before we discussed the issue of backwards-incompatible changes (https://github.com/esmci/cime/wiki/Meeting-Notes#apr-3-2019), but I don't think we thought of this given change as backwards-incompatible at the time. After experiencing the problems caused by this on my own machine (which I just ran into now because we just recently updated our cime version in CTSM), I see that any changes that force users to change their config_machines or config_compilers files should be considered backwards-incompatible.

@jgfouca @jedwards4b @mvertens @rljacob @fischer-ncar 


Discussion:
Note:  " maintain on their own machine" means config files kept in a ~/.cime directory.
Discussion from telecon:  We need to recognize that any PRs requiring changes to machine config files introduces backward incompatibility.  And we then need to publicize that so people can change their .cime/config files.

Resolving patch:
diff --git a/scripts/lib/CIME/XML/compilers.py b/scripts/lib/CIME/XML/compilers.py
--- a/scripts/lib/CIME/XML/compilers.py
+++ b/scripts/lib/CIME/XML/compilers.py
@@ -24,16 +24,16 @@ def __init__(self, machobj, infile=None, compiler=None, mpilib=None, files=None,
             if files is None:
                 files = Files()
             infile = files.get_value("COMPILERS_SPEC_FILE")
-            schema = files.get_schema("COMPILERS_SPEC_FILE")
+        schema = files.get_schema("COMPILERS_SPEC_FILE")
 
         GenericXML.__init__(self, infile, schema)
-        self._machobj = machobj
         if version is not None:
             # this is used in scripts_regression_tests to force version 2, it should not be used otherwise
             self._version = version
         else:
             self._version = self.get_version()
 
+        self._machobj = machobj
         self.machine  = machobj.get_machine_name()
         self.os = machobj.get_value("OS")
         if compiler is None:
@@ -52,7 +52,7 @@ def __init__(self, machobj, infile=None, compiler=None, mpilib=None, files=None,
         #This could cause problems if node matchs are repeated when only one is expected
         infile = os.path.join(os.environ.get("HOME"),".cime","config_compilers.xml")
         if os.path.exists(infile):
-            GenericXML.read(self, infile)
+            GenericXML.read(self, infile, schema=schema)
 
         if self.compiler is not None:
             self.set_compiler(compiler)


Test patch: