Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New allow_error field for module system #2317

Merged
merged 1 commit into from
Feb 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/e3sm/machines/config_machines.xml
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@
<arg name="tasks_per_node"> --map-by ppr:{{ tasks_per_numa }}:socket:PE=$ENV{OMP_NUM_THREADS} --bind-to hwthread</arg>
</arguments>
</mpirun>
<module_system type="module">
<module_system type="module" allow_error="false">
<init_path lang="python">/usr/share/Modules/init/python.py</init_path>
<init_path lang="perl">/usr/share/Modules/init/perl.pm</init_path>
<init_path lang="sh">/usr/share/Modules/init/sh</init_path>
Expand Down
1 change: 1 addition & 0 deletions config/xml_schemas/env_mach_specific.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<xs:element minOccurs="0" maxOccurs="unbounded" ref="modules"/>
</xs:sequence>
<xs:attribute name="type" use="required" type="xs:NCName"/>
<xs:attribute name="allow_error" type="xs:boolean"/>
</xs:complexType>
</xs:element>

Expand Down
13 changes: 12 additions & 1 deletion scripts/lib/CIME/XML/env_mach_specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def _load_module_modules(self, modules_to_load):
for cmd in self._get_module_commands(modules_to_load, "python"):
logger.debug("module command is {}".format(cmd))
stat, py_module_code, errout = run_cmd(cmd)
expect(stat==0 and len(errout) == 0,
expect(stat==0 and (len(errout) == 0 or self.allow_error()),
"module command {} failed with message:\n{}".format(cmd, errout))
exec(py_module_code)

Expand Down Expand Up @@ -354,6 +354,17 @@ def get_module_system_type(self):
module_system = self.get_child("module_system")
return self.get(module_system, "type")

def allow_error(self):
"""
Return True if stderr output from module commands should be assumed
to be an error. Default False. This is necessary since implementations
of environment modules are highlty variable and some systems produce
stderr output even when things are working fine.
"""
module_system = self.get_child("module_system")
value = self.get(module_system, "allow_error")
return value.upper() == "TRUE" if value is not None else False

def get_module_system_init_path(self, lang):
init_nodes = self.get_optional_child("init_path", attributes={"lang":lang}, root=self.get_child("module_system"))
return self.text(init_nodes) if init_nodes is not None else None
Expand Down