Repository: ESMCI/cime

Issue:
get_timing.py specifies component classes by hand
Are lines like this:
`for k in ['CPL', 'GLC', 'WAV', 'LND', 'ROF', 'ICE', 'ATM', 'OCN']:`
appropriate in get_timing.py? They prevent get_timing from automatically picking up new component types (e.g., ESP).


Discussion:

Resolving patch:
diff --git a/scripts/lib/CIME/SystemTests/pem.py b/scripts/lib/CIME/SystemTests/pem.py
--- a/scripts/lib/CIME/SystemTests/pem.py
+++ b/scripts/lib/CIME/SystemTests/pem.py
@@ -26,7 +26,7 @@ def _case_one_setup(self):
         pass
 
     def _case_two_setup(self):
-        for comp in ['ATM','CPL','OCN','WAV','GLC','ICE','ROF','LND']:
+        for comp in self._case.get_values("COMP_CLASSES"):
             ntasks = self._case.get_value("NTASKS_%s"%comp)
             if ( ntasks > 1 ):
                 self._case.set_value("NTASKS_%s"%comp, int(ntasks/2))
diff --git a/scripts/lib/CIME/SystemTests/pet.py b/scripts/lib/CIME/SystemTests/pet.py
--- a/scripts/lib/CIME/SystemTests/pet.py
+++ b/scripts/lib/CIME/SystemTests/pet.py
@@ -14,8 +14,6 @@
 
 class PET(SystemTestsCompareTwo):
 
-    _COMPONENT_LIST = ('ATM','CPL','OCN','WAV','GLC','ICE','ROF','LND')
-
     def __init__(self, case):
         """
         initialize a test object
@@ -28,7 +26,7 @@ def __init__(self, case):
 
     def _case_one_setup(self):
         # first make sure that all components have threaded settings
-        for comp in self._COMPONENT_LIST:
+        for comp in self._case.get_values("COMP_CLASSES"):
             if self._case.get_value("NTHRDS_%s"%comp) <= 1:
                 self._case.set_value("NTHRDS_%s"%comp, 2)
 
@@ -37,7 +35,7 @@ def _case_one_setup(self):
 
     def _case_two_setup(self):
         #Do a run with all threads set to 1
-        for comp in self._COMPONENT_LIST:
+        for comp in self._case.get_values("COMP_CLASSES"):
             self._case.set_value("NTHRDS_%s"%comp, 1)
 
         # The need for this is subtle. On batch systems, the entire PET test runs
diff --git a/scripts/lib/CIME/get_timing.py b/scripts/lib/CIME/get_timing.py
--- a/scripts/lib/CIME/get_timing.py
+++ b/scripts/lib/CIME/get_timing.py
@@ -245,7 +245,7 @@ def getTiming(self):
         self.write("  ---------        ------     -------   ------   "
                    "------  ---------  ------  \n")
         maxthrds = 0
-        for k in ['CPL', 'GLC', 'WAV', 'LND', 'ROF', 'ICE', 'ATM', 'OCN']:
+        for k in self.case.get_values("COMP_CLASSES"):
             m = self.models[k]
             self.write("  %s = %-8s   %-6u      %-6u   %-6u x %-6u  "
                        "%-6u (%-6u) \n"
@@ -333,7 +333,7 @@ def getTiming(self):
 
         self.write("    TOT Run Time:  %10.3f seconds   %10.3f seconds/mday   "
                    "%10.2f myears/wday \n" % (tmax, tmax/adays, tmaxr))
-        for k in ['LND', 'ROF', 'ICE', 'ATM', 'OCN', 'GLC', 'WAV', 'CPL']:
+        for k in self.case.get_values("COMP_CLASSES"):
             m = self.models[k]
             self.write("    %s Run Time:  %10.3f seconds   "
                        "%10.3f seconds/mday   %10.2f myears/wday \n"


Test patch:
diff --git a/scripts/lib/CIME/test_scheduler.py b/scripts/lib/CIME/test_scheduler.py
--- a/scripts/lib/CIME/test_scheduler.py
+++ b/scripts/lib/CIME/test_scheduler.py
@@ -218,13 +218,15 @@ def __init__(self, test_names, test_data=None,
                         else:
                             self._update_test_status(test, phase, TEST_PEND_STATUS)
                             self._update_test_status(test, phase, status)
+                logger.info("Using existing test directory %s"%(self._get_test_dir(test)))
         else:
             # None of the test directories should already exist.
             for test in self._tests:
                 expect(not os.path.exists(self._get_test_dir(test)),
                        "Cannot create new case in directory '%s', it already exists."
                        " Pick a different test-id" % self._get_test_dir(test))
-        logger.info("Created test in directory %s"%self._get_test_dir(test))
+                logger.info("Creating test directory %s"%(self._get_test_dir(test)))
+
         # By the end of this constructor, this program should never hard abort,
         # instead, errors will be placed in the TestStatus files for the various
         # tests cases