Skip to content

Commit

Permalink
Merge branch 'jgfouca/cime/fix_create_test' into next (PR #3319)
Browse files Browse the repository at this point in the history
Fix create_test bug when determining BASELINE_ROOT #3319

[BFB]

* jgfouca/cime/fix_create_test:
  Fix
  • Loading branch information
jgfouca committed Nov 15, 2019
2 parents ac9d521 + ae53686 commit fdc88c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
16 changes: 8 additions & 8 deletions cime/scripts/lib/CIME/XML/machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(self, infile=None, files=None, machine=None):
self.machine_node = None
self.machine = None
self.machines_dir = None
self.custom_settings = {}
schema = None
if files is None:
files = Files()
Expand Down Expand Up @@ -171,6 +172,7 @@ def set_machine(self, machine):
self.machine = machine

return machine

#pylint: disable=arguments-differ
def get_value(self, name, attributes=None, resolved=True, subgroup=None):
"""
Expand All @@ -180,6 +182,9 @@ def get_value(self, name, attributes=None, resolved=True, subgroup=None):
expect(subgroup is None, "This class does not support subgroups")
value = None

if name in self.custom_settings:
return self.custom_settings[name]

# COMPILER and MPILIB are special, if called without arguments they get the default value from the
# COMPILERS and MPILIBS lists in the file.
if name == "COMPILER":
Expand All @@ -190,6 +195,7 @@ def get_value(self, name, attributes=None, resolved=True, subgroup=None):
node = self.get_optional_child(name, root=self.machine_node, attributes=attributes)
if node is not None:
value = self.text(node)

if resolved:
if value is not None:
value = self.get_resolved_value(value)
Expand Down Expand Up @@ -298,14 +304,8 @@ def get_suffix(self, suffix_type):
return None

def set_value(self, vid, value, subgroup=None, ignore_type=True):
tmproot = self.root
self.root = self.machine_node
#pylint: disable=assignment-from-no-return
result = super(Machines, self).set_value(vid, value, subgroup=subgroup,
ignore_type=ignore_type)
self.root = tmproot
return result

# A temporary cache only
self.custom_settings[vid] = value

def print_values(self):
# write out machines
Expand Down
8 changes: 5 additions & 3 deletions cime/scripts/lib/CIME/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,12 @@ def __init__(self, test_names, test_data=None,
self._baseline_cmp_name = baseline_cmp_name # Implies comparison should be done if not None
self._baseline_gen_name = baseline_gen_name # Implies generation should be done if not None

# Compute baseline_root. Do NOT resolve it since it could depend on other
# settings (compiler, project) that might not necessarily be defaulted.
# Compute baseline_root. Need to set some properties on machobj in order for
# the baseline_root to resolve correctly.
self._machobj.set_value("COMPILER", self._compiler)
self._machobj.set_value("PROJECT", self._project)
self._baseline_root = os.path.abspath(baseline_root) if baseline_root is not None \
else self._machobj.get_value("BASELINE_ROOT", resolved=False)
else self._machobj.get_value("BASELINE_ROOT")

if baseline_cmp_name or baseline_gen_name:
if self._baseline_cmp_name:
Expand Down

0 comments on commit fdc88c1

Please sign in to comment.