From 5b514ccf0e075b66c9ed5bc13fb6b54cc98b14af Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 15 Aug 2016 11:48:46 -0600 Subject: [PATCH 1/3] fix more early resolve issues --- driver_cpl/cime_config/config_component.xml | 8 -------- utils/python/CIME/XML/machines.py | 6 +++--- utils/python/CIME/case.py | 11 ++++------- utils/python/CIME/utils.py | 4 ++-- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/driver_cpl/cime_config/config_component.xml b/driver_cpl/cime_config/config_component.xml index cf4881ddda8..c1b10351181 100644 --- a/driver_cpl/cime_config/config_component.xml +++ b/driver_cpl/cime_config/config_component.xml @@ -1766,14 +1766,6 @@ Machine name - - char - - case_def - env_case.xml - full pathname of file specifying supported machines location - - char diff --git a/utils/python/CIME/XML/machines.py b/utils/python/CIME/XML/machines.py index 5c861ca1311..8b83c9d6f61 100644 --- a/utils/python/CIME/XML/machines.py +++ b/utils/python/CIME/XML/machines.py @@ -27,9 +27,9 @@ def __init__(self, infile=None, files=None, machine=None): if infile is None: if files is None: files = Files() - infile = files.get_value("MACHINES_SPEC_FILE") + infile = files.get_value("MACHINES_SPEC_FILE", resolved=False) self.machines_dir = os.path.dirname(infile) - + infile = files.get_resolved_value(infile) GenericXML.__init__(self, infile) # Append the contents of $HOME/.cime/config_machines.xml if it exists @@ -340,7 +340,7 @@ def get_full_mpirun(self, check_members, case, job): batch_system = self.get_value("BATCH_SYSTEM") if batch_system == "cobalt": mpi_arg_string += " : " - + return "%s %s %s" % (executable if executable is not None else "", mpi_arg_string, default_run_suffix) def print_values(self): diff --git a/utils/python/CIME/case.py b/utils/python/CIME/case.py index 0ed270cd38d..711676c15c0 100644 --- a/utils/python/CIME/case.py +++ b/utils/python/CIME/case.py @@ -91,7 +91,6 @@ def __init__(self, case_root=None, read_only=True): self._pesfile = None self._gridfile = None self._components = [] - self._component_config_files = [] self._component_classes = [] # Define __enter__ and __exit__ so that we can use this as a context manager @@ -399,12 +398,14 @@ def _get_component_config_data(self): comp_class = self._component_classes[i] comp_name = self._components[i-1] node_name = 'CONFIG_' + comp_class + '_FILE' - comp_config_file = files.get_value(node_name, {"component":comp_name}, resolved=True) + # Add the group and elements for the config_files.xml + comp_config_file = files.get_value(node_name, {"component":comp_name}, resolved=False) + self.set_value(node_name, comp_config_file) + comp_config_file = self.get_resolved_value(comp_config_file) expect(comp_config_file is not None,"No config file for component %s"%comp_name) compobj = Component(comp_config_file) for env_file in self._env_entryid_files: env_file.add_elements_by_group(compobj, attributes=attlist) - self._component_config_files.append((node_name,comp_config_file)) # Add the group and elements for the config_files.xml for env_file in self._env_entryid_files: @@ -474,10 +475,6 @@ def configure(self, compset_name, grid_name, machine_name=None, self.get_compset_var_settings() - # Add the group and elements for the config_files.xml - for config_file in self._component_config_files: - self.set_value(config_file[0],config_file[1]) - #-------------------------------------------- # machine #-------------------------------------------- diff --git a/utils/python/CIME/utils.py b/utils/python/CIME/utils.py index 947db7276c4..7899ab3883a 100644 --- a/utils/python/CIME/utils.py +++ b/utils/python/CIME/utils.py @@ -21,8 +21,8 @@ def expect(condition, error_msg, exc_type=SystemExit): """ if (not condition): # Uncomment these to bring up a debugger when an expect fails - #import pdb - #pdb.set_trace() + import pdb + pdb.set_trace() raise exc_type("ERROR: %s" % error_msg) # Should only be called from get_cime_config() From 87d0c1a620d86770e03df14542ecac057008c64d Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 15 Aug 2016 13:32:10 -0600 Subject: [PATCH 2/3] update clone cimeroot variable --- utils/python/CIME/case.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/python/CIME/case.py b/utils/python/CIME/case.py index 711676c15c0..f293d3306b1 100644 --- a/utils/python/CIME/case.py +++ b/utils/python/CIME/case.py @@ -9,7 +9,7 @@ from CIME.XML.standard_module_setup import * from CIME.utils import expect, get_cime_root, append_status -from CIME.utils import convert_to_type, get_model, get_project +from CIME.utils import convert_to_type, get_model, get_project, get_current_branch from CIME.XML.machines import Machines from CIME.XML.pes import Pes from CIME.XML.files import Files @@ -826,13 +826,17 @@ def create_clone(self, newcase, keepexe=False, mach_dir=None, project=None): # create clone from self to case clone_cimeroot = self.get_value("CIMEROOT") if newcase_cimeroot != clone_cimeroot: + case_branch = get_current_branch(clone_cimeroot) + clone_branch = get_current_branch(newcase_cimeroot) logger.warning(" case CIMEROOT is %s " %newcase_cimeroot) logger.warning(" clone CIMEROOT is %s " %clone_cimeroot) - logger.warning(" It is NOT recommended to clone cases from different versions of CIMEROOT") + logger.warning(" It is NOT recommended to clone cases from different versions of CIME %s %s"%(case_branch, clone_branch)) + # *** create case object as deepcopy of clone object *** srcroot = os.path.join(newcase_cimeroot,"..") newcase = self.copy(newcasename, newcaseroot, newsrcroot=srcroot) + newcase.set_value("CIMEROOT", newcase_cimeroot) # determine if will use clone executable or not if keepexe: From de9c59d860f69bb5f4449eb9dedc9ad00062f54e Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 15 Aug 2016 13:48:19 -0600 Subject: [PATCH 3/3] clean up debug code --- utils/python/CIME/case.py | 4 +++- utils/python/CIME/utils.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/utils/python/CIME/case.py b/utils/python/CIME/case.py index 711676c15c0..0e44ce3fc56 100644 --- a/utils/python/CIME/case.py +++ b/utils/python/CIME/case.py @@ -828,11 +828,13 @@ def create_clone(self, newcase, keepexe=False, mach_dir=None, project=None): if newcase_cimeroot != clone_cimeroot: logger.warning(" case CIMEROOT is %s " %newcase_cimeroot) logger.warning(" clone CIMEROOT is %s " %clone_cimeroot) - logger.warning(" It is NOT recommended to clone cases from different versions of CIMEROOT") + logger.warning(" It is NOT recommended to clone cases from different versions of CIME.") + # *** create case object as deepcopy of clone object *** srcroot = os.path.join(newcase_cimeroot,"..") newcase = self.copy(newcasename, newcaseroot, newsrcroot=srcroot) + newcase.set_value("CIMEROOT", newcase_cimeroot) # determine if will use clone executable or not if keepexe: diff --git a/utils/python/CIME/utils.py b/utils/python/CIME/utils.py index 7899ab3883a..947db7276c4 100644 --- a/utils/python/CIME/utils.py +++ b/utils/python/CIME/utils.py @@ -21,8 +21,8 @@ def expect(condition, error_msg, exc_type=SystemExit): """ if (not condition): # Uncomment these to bring up a debugger when an expect fails - import pdb - pdb.set_trace() + #import pdb + #pdb.set_trace() raise exc_type("ERROR: %s" % error_msg) # Should only be called from get_cime_config()