-
Notifications
You must be signed in to change notification settings - Fork 219
probe external modules for missing metadata that is not provided via extermal module metadata file #3174
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
probe external modules for missing metadata that is not provided via extermal module metadata file #3174
Changes from 7 commits
d56f4fa
dc51f55
54d9722
00d0077
46473d5
9cdf2ed
afe4e11
5d87a9a
6648542
bab80b3
b3152c7
e6f3eb7
6d3a63e
1a8cf18
b80c8d6
e36cde2
1507e62
0277662
12573ab
a9facb3
227a9fd
1fbea39
3aed793
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ | |
| :author: Alan O'Cais (Juelich Supercomputing Centre) | ||
| :author: Bart Oldeman (McGill University, Calcul Quebec, Compute Canada) | ||
| :author: Maxime Boissonneault (Universite Laval, Calcul Quebec, Compute Canada) | ||
| :author: Victor Holanda (CSCS, ETH Zurich) | ||
| """ | ||
|
|
||
| import copy | ||
|
|
@@ -61,7 +62,7 @@ | |
| from easybuild.tools.config import LOCAL_VAR_NAMING_CHECK_ERROR, LOCAL_VAR_NAMING_CHECK_LOG, LOCAL_VAR_NAMING_CHECK_WARN | ||
| from easybuild.tools.config import Singleton, build_option, get_module_naming_scheme | ||
| from easybuild.tools.filetools import EASYBLOCK_CLASS_PREFIX, copy_file, decode_class_name, encode_class_name | ||
| from easybuild.tools.filetools import find_backup_name_candidate, find_easyconfigs, read_file, write_file | ||
| from easybuild.tools.filetools import convert_name, find_backup_name_candidate, find_easyconfigs, read_file, write_file | ||
| from easybuild.tools.hooks import PARSE, load_hooks, run_hook | ||
| from easybuild.tools.module_naming_scheme.mns import DEVEL_MODULE_SUFFIX | ||
| from easybuild.tools.module_naming_scheme.utilities import avail_module_naming_schemes, det_full_ec_version | ||
|
|
@@ -1152,6 +1153,52 @@ def _validate(self, attr, values): # private method | |
| if self[attr] and self[attr] not in values: | ||
| raise EasyBuildError("%s provided '%s' is not valid: %s", attr, self[attr], values) | ||
|
|
||
| def handle_external_module_metadata_by_probing_modules(self, dep_name): | ||
| """ | ||
| helper function for handle_external_module_metadata | ||
| handles metadata for external module dependencies when there is not entry in the | ||
| metadata file | ||
|
|
||
| It should look for the pair of variables definitions in the available modules | ||
| 1. CRAY_XXXX_PREFIX and CRAY_XXXX_VERSION | ||
| 2. CRAY_XXXX_DIR and CRAY_XXXX_VERSION | ||
| 2. CRAY_XXXX_ROOT and CRAY_XXXX_VERSION | ||
| 5. XXXX_PREFIX and XXXX_VERSION | ||
| 4. XXXX_DIR and XXXX_VERSION | ||
| 5. XXXX_ROOT and XXXX_VERSION | ||
| 3. XXXX_HOME and XXXX_VERSION | ||
|
|
||
| If neither of the pairs is found, then an empty dictionary is returned | ||
| """ | ||
| dependency = {} | ||
|
|
||
| short_ext_modname = dep_name.split('/')[0] | ||
| short_ext_modname_upper = convert_name(short_ext_modname, upper=True) | ||
|
|
||
| allowed_pairs = [ | ||
| ('CRAY_%s_PREFIX' % short_ext_modname_upper, 'CRAY_%s_VERSION' % short_ext_modname_upper), | ||
migueldiascosta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ('CRAY_%s_DIR' % short_ext_modname_upper, 'CRAY_%s_VERSION' % short_ext_modname_upper), | ||
| ('CRAY_%s_ROOT' % short_ext_modname_upper, 'CRAY_%s_VERSION' % short_ext_modname_upper), | ||
| ('%s_PREFIX' % short_ext_modname_upper, '%s_VERSION' % short_ext_modname_upper), | ||
| ('%s_DIR' % short_ext_modname_upper, '%s_VERSION' % short_ext_modname_upper), | ||
| ('%s_ROOT' % short_ext_modname_upper, '%s_VERSION' % short_ext_modname_upper), | ||
| ('%s_HOME' % short_ext_modname_upper, '%s_VERSION' % short_ext_modname_upper), | ||
| ] | ||
|
|
||
| for p, v in allowed_pairs: | ||
| prefix = self.modules_tool.get_variable_from_modulefile(dep_name, p) | ||
| version = self.modules_tool.get_variable_from_modulefile(dep_name, v) | ||
|
|
||
| if prefix and version: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if prefix is found but not version, and if the version is in
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The point is to only trust the metadata obtained by probing the module if it provides both the installation prefix and software version. Let's go forward as is with this strict requirement, which can easily be loosened up later (the other way around is more difficult). The other scenario, where the prefix is already known from the metadata file, but (only) the version is available through the module, may actually be more likely (since the prefix can be specified as the name of the environment variable specifying the installation prefix, not an actual hardcoded prefix, which can be done generically in the metadata file). |
||
| dependency = { | ||
| 'name': [short_ext_modname], | ||
| 'version': [version], | ||
| 'prefix': p | ||
| } | ||
| break | ||
|
|
||
| return dependency | ||
|
|
||
| def handle_external_module_metadata(self, dep_name): | ||
| """ | ||
| helper function for _parse_dependency | ||
|
|
@@ -1163,7 +1210,9 @@ def handle_external_module_metadata(self, dep_name): | |
| self.log.info("Updated dependency info with available metadata for external module %s: %s", | ||
| dep_name, dependency['external_module_metadata']) | ||
| else: | ||
| self.log.info("No metadata available for external module %s", dep_name) | ||
| self.log.info("No metadata available for external module %s. Attempting to read from available modules", | ||
| dep_name) | ||
victorusu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| dependency['external_module_metadata'] = self.handle_external_module_metadata_by_probing_modules(dep_name) | ||
migueldiascosta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| return dependency | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.