Skip to content

Commit

Permalink
Merge pull request #4569 from jedwards4b/machines_v3_fix
Browse files Browse the repository at this point in the history
Add read of .cime/machine/config_machines.xml file if it exists.

Test suite: Hand testing with and without .cime/machine/config_machines.xml
Test baseline:
Test namelist changes:
Test status: bit for bit

Fixes #4568

User interface changes?:

Update gh-pages html (Y/N)?:
  • Loading branch information
jasonb5 authored Jan 24, 2024
2 parents d2ec81a + 5f67534 commit 7b0bd56
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
19 changes: 15 additions & 4 deletions CIME/XML/machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from CIME.utils import convert_to_unknown_type, get_cime_config

import socket
from pathlib import Path

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -317,15 +318,25 @@ def set_machine(self, machine, schema=None):
if machine == "Query":
return machine
elif self.get_version() == 3:
machines_file = os.path.join(
self.machines_dir, machine, "config_machines.xml"
)
if os.path.isfile(machines_file):
machines_file = Path.home() / ".cime" / machine / "config_machines.xml"

if machines_file.exists():
GenericXML.read(
self,
machines_file,
schema=schema,
)
else:
machines_file = (
Path(self.machines_dir) / machine / "config_machines.xml"
)

if machines_file.exists():
GenericXML.read(
self,
machines_file,
schema=schema,
)
self.machine_node = super(Machines, self).get_child(
"machine",
{"MACH": machine},
Expand Down
2 changes: 1 addition & 1 deletion CIME/non_py/cprnc

0 comments on commit 7b0bd56

Please sign in to comment.