Skip to content

Commit 7e09c0d

Browse files
committed
Skip module sanity checking when module resolution is off
1 parent 5986ed5 commit 7e09c0d

File tree

2 files changed

+47
-18
lines changed

2 files changed

+47
-18
lines changed

reframe/core/modules.py

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,22 +106,22 @@ class ModulesSystem:
106106
module_map = fields.TypedField(types.Dict[str, types.List[str]])
107107

108108
@classmethod
109-
def create(cls, modules_kind=None):
109+
def create(cls, modules_kind=None, module_resolution=True):
110110
getlogger().debug(f'Initializing modules system {modules_kind!r}')
111111
if modules_kind is None or modules_kind == 'nomod':
112112
return ModulesSystem(NoModImpl())
113113
elif modules_kind == 'tmod31':
114-
return ModulesSystem(TMod31Impl())
114+
return ModulesSystem(TMod31Impl(module_resolution))
115115
elif modules_kind == 'tmod':
116-
return ModulesSystem(TModImpl())
116+
return ModulesSystem(TModImpl(module_resolution))
117117
elif modules_kind == 'tmod32':
118-
return ModulesSystem(TModImpl())
118+
return ModulesSystem(TModImpl(module_resolution))
119119
elif modules_kind == 'tmod4':
120-
return ModulesSystem(TMod4Impl())
120+
return ModulesSystem(TMod4Impl(module_resolution))
121121
elif modules_kind == 'lmod':
122-
return ModulesSystem(LModImpl())
122+
return ModulesSystem(LModImpl(module_resolution))
123123
elif modules_kind == 'spack':
124-
return ModulesSystem(SpackImpl())
124+
return ModulesSystem(SpackImpl(module_resolution))
125125
else:
126126
raise ConfigError('unknown module system: %s' % modules_kind)
127127

@@ -585,7 +585,12 @@ class TModImpl(ModulesSystemImpl):
585585

586586
MIN_VERSION = (3, 2)
587587

588-
def __init__(self):
588+
def __init__(self, module_resolution=True):
589+
if not module_resolution:
590+
# The module system may not be available locally
591+
self._version = None
592+
return
593+
589594
# Try to figure out if we are indeed using the TCL version
590595
try:
591596
completed = osext.run_command('modulecmd -V')
@@ -717,7 +722,14 @@ class TMod31Impl(TModImpl):
717722

718723
MIN_VERSION = (3, 1)
719724

720-
def __init__(self):
725+
def __init__(self, module_resolution=True):
726+
self._version = None
727+
self._command = None
728+
729+
if not module_resolution:
730+
# The module system may not be available locally
731+
return
732+
721733
# Try to figure out if we are indeed using the TCL version
722734
try:
723735
modulecmd = os.getenv('MODULESHOME')
@@ -792,7 +804,13 @@ class TMod4Impl(TModImpl):
792804

793805
MIN_VERSION = (4, 1)
794806

795-
def __init__(self):
807+
def __init__(self, module_resolution=True):
808+
self._version = None
809+
self._extra_module_paths = []
810+
if not module_resolution:
811+
# The module system may not be available locally
812+
return
813+
796814
try:
797815
completed = osext.run_command(self.modulecmd('-V'), check=True)
798816
except OSError as e:
@@ -915,7 +933,13 @@ def searchpath_remove(self, *dirs):
915933
class LModImpl(TMod4Impl):
916934
'''Module system for Lmod (Tcl/Lua).'''
917935

918-
def __init__(self):
936+
def __init__(self, module_resolution=True):
937+
self._extra_module_paths = []
938+
self._version = None
939+
if not module_resolution:
940+
# The module system may not be available locally
941+
return
942+
919943
# Try to figure out if we are indeed using LMOD
920944
self._lmod_cmd = os.getenv('LMOD_CMD')
921945
if self._lmod_cmd is None:
@@ -945,8 +969,6 @@ def __init__(self):
945969
raise ConfigError('Python is not supported by '
946970
'this Lmod installation')
947971

948-
self._extra_module_paths = []
949-
950972
def name(self):
951973
return 'lmod'
952974

@@ -1094,7 +1116,14 @@ class SpackImpl(ModulesSystemImpl):
10941116
10951117
'''
10961118

1097-
def __init__(self):
1119+
def __init__(self, module_resolution=True):
1120+
self._name_format = '{name}/{version}-{hash}'
1121+
self._version = None
1122+
1123+
if not module_resolution:
1124+
# The module system may not be available locally
1125+
return
1126+
10981127
# Try to figure out if we are indeed using the TCL version
10991128
try:
11001129
completed = osext.run_command('spack -V')
@@ -1103,7 +1132,6 @@ def __init__(self):
11031132
'could not find a sane Spack installation') from e
11041133

11051134
self._version = completed.stdout.strip()
1106-
self._name_format = '{name}/{version}-{hash}'
11071135

11081136
def name(self):
11091137
return 'spack'

reframe/core/systems.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,12 @@ class System(jsonext.JSONSerializable):
462462

463463
def __init__(self, name, descr, hostnames, modules_system,
464464
preload_env, prefix, outputdir,
465-
resourcesdir, stagedir, partitions):
465+
resourcesdir, stagedir, partitions, module_resolution):
466466
getlogger().debug(f'Initializing system {name!r}')
467467
self._name = name
468468
self._descr = descr
469469
self._hostnames = hostnames
470-
self._modules_system = ModulesSystem.create(modules_system)
470+
self._modules_system = ModulesSystem.create(modules_system, module_resolution)
471471
self._preload_env = preload_env
472472
self._prefix = prefix
473473
self._outputdir = outputdir
@@ -590,7 +590,8 @@ def create(cls, site_config):
590590
outputdir=site_config.get('systems/0/outputdir'),
591591
resourcesdir=site_config.get('systems/0/resourcesdir'),
592592
stagedir=site_config.get('systems/0/stagedir'),
593-
partitions=partitions
593+
partitions=partitions,
594+
module_resolution=site_config.get('general/resolve_module_conflicts')
594595
)
595596

596597
@property

0 commit comments

Comments
 (0)