Repository: ESMCI/cime

Issue:
some values in config_pes.xml were not getting set in case 
config_pes.xml sets ntasks, nthrds and rootpe but can also set other variables such as PES_PER_NODE, these other variables are being ignored in cime5 



Discussion:

Resolving patch:
diff --git a/utils/python/CIME/XML/pes.py b/utils/python/CIME/XML/pes.py
--- a/utils/python/CIME/XML/pes.py
+++ b/utils/python/CIME/XML/pes.py
@@ -26,7 +26,9 @@ def find_pes_layout(self, grid, compset, machine, pesize_opts='M'):
         mach_choice = None
         compset_choice = None
         pesize_choice = None
+        other_settings = {}
         max_points = -1
+
         # Get all the nodes
         grid_nodes = self.get_nodes("grid")
         for grid_node in grid_nodes:
@@ -62,16 +64,22 @@ def find_pes_layout(self, grid, compset, machine, pesize_opts='M'):
                                     logger.warn("points = %d"%points)
                                     expect(False, "We dont expect to be here" )
 
-        pes_ntasks, pes_nthrds, pes_rootpe = {}, {}, {}
-        for pes_data, xpath in [(pes_ntasks, "ntasks"),
-                                (pes_nthrds, "nthrds"),
-                                (pes_rootpe, "rootpe")]:
-            nodes = pe_select.findall(".//%s/*" % xpath)
-            for node in nodes:
-                name = node.tag.upper()
-                value = node.text
-                pes_data[name] = value
-                logger.debug("%s %s " % (name, value))
+        pes_ntasks, pes_nthrds, pes_rootpe, other_settings = {}, {}, {}, {}
+        for node in pe_select:
+            vid = node.tag
+            logger.warn("vid is %s"%vid)
+            if "ntasks" in vid:
+                for child in node:
+                    pes_ntasks[child.tag.upper()] = child.text
+            elif "nthrds" in vid:
+                for child in node:
+                    pes_nthrds[child.tag.upper()] = child.text
+            elif "rootpe" in vid:
+                for child in node:
+                    pes_rootpe[child.tag.upper()] = child.text
+            # if the value is already upper case its something else we are trying to set
+            elif vid == node.tag:
+                other_settings[vid] = node.text
 
         logger.info("Pes setting: grid          is %s " %grid)
         logger.info("Pes setting: compset       is %s " %compset)
@@ -79,5 +87,5 @@ def find_pes_layout(self, grid, compset, machine, pesize_opts='M'):
         logger.info("Pes setting: machine match is %s " %mach_choice)
         logger.info("Pes setting: compset_match is %s " %compset_choice)
         logger.info("Pes setting: pesize match  is %s " %pesize_choice)
-
-        return pes_ntasks, pes_nthrds, pes_rootpe
+        logger.info("Pes other settings: %s"%other_settings)
+        return pes_ntasks, pes_nthrds, pes_rootpe, other_settings
diff --git a/utils/python/CIME/case.py b/utils/python/CIME/case.py
--- a/utils/python/CIME/case.py
+++ b/utils/python/CIME/case.py
@@ -558,9 +558,12 @@ def configure(self, compset_name, grid_name, machine_name=None,
         else:
             pesobj = Pes(self._pesfile)
 
-            pes_ntasks, pes_nthrds, pes_rootpe = pesobj.find_pes_layout(self._gridname, self._compsetname,
+            pes_ntasks, pes_nthrds, pes_rootpe, other = pesobj.find_pes_layout(self._gridname, self._compsetname,
                                                                     machine_name, pesize_opts=pecount)
 
+
+
+
         mach_pes_obj = self.get_env("mach_pes")
         totaltasks = {}
         for key, value in pes_ntasks.items():
@@ -572,6 +575,9 @@ def configure(self, compset_name, grid_name, machine_name=None,
         for key, value in pes_nthrds.items():
             totaltasks[key[-3:]] *= int(value)
             mach_pes_obj.set_value(key,int(value))
+        for key, value in other.items():
+            self.set_value(key, value)
+
         maxval = 1
         pes_per_node = mach_pes_obj.get_value("PES_PER_NODE")
         for key, val in totaltasks.items():


Test patch: