-
Notifications
You must be signed in to change notification settings - Fork 203
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
refactor generation of required environment variables in module files + deprecate make_module_req_guess
method in EasyBlock
class
#4653
base: 5.0.x
Are you sure you want to change the base?
Conversation
@boegel look all the beautiful green tests! Compared to what I showed on the meeting yesterday, I have undone all changes to This seems ready on my side. I tested it with several easyblocks that add custom stuff to |
…d_module_search_path
…nment variables for module files
…r modules on load
…ed library directories
…ding paths for environment of modules
…er explicit checks in the module step
…vironmentVariable
…file of subsequent installations
add test to verify that environment variables don't leak into module file of subsequent installations
@lexming Can you look into fixing the merge conflict, and get the test to pass? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor renaming + style fixes for refactoring generation of required environment variables in module files
…module_req_guess is detected
… property based on new ModEnvVarType enum
…e to control requirements of paths to directories
…ular order of list entries
…link to something else than LibSymlink.UNKNOWN
…TOP_FILES rather than string values
# Only inject path-like environment variables into module file | ||
env_var_requirements = sorted([ | ||
(envar_name, envar_val) for envar_name, envar_val in self.module_load_environment.items() | ||
if envar_val.is_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lexming Shouldn't we at least log a warning or something if any entries in self.module_load_environment
do not have is_path
is True?
Because those cases will essentially be totally silently ignores currently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep we can log that, not sure if this deserves a warning though. I guess there might be cases where no path is added to the module file that are ok, like a ModuleRC
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suggestion relates more to entries in self.module_load_environment
for which is_path
is False
, those cases should be exposed clearly rather than silently ignoring them?
easybuild/framework/easyblock.py
Outdated
lines.append(self.module_generator.prepend_paths(key, paths)) | ||
path_type = search_paths.type | ||
if fake: | ||
path_type = ModEnvVarType.PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lexming Is this only done to bypass the check in expand_module_search_path
that ensures that this directory actually has files in them?
Why? Is it only to get some marginal speedup?
This may be important, the "fake" module is generated right before the sanity check is run, so if for some weird reason having additional paths to empty directories in environment variables causes trouble (or worse, somehow makes the sanity check pass), it sort of invalidates the sanity check...
Is there another reason to make this exception beyond a small performance optimization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point this was needed, but I lost the specifics. This PR increases the amount of paths that are checked for existence before injection into the module file and I remember having issues with fake modules lacking paths that are non-existent at the time of creation of the fake, but exist in the end. However, I'm not hitting those issues anymore, so I'll revert it and see if they happen again.
minor changes w.r.t. ModuleLoadEnvironment and ModEnvVarType
This reverts commit 13f735c.
@boegel actually the tests is what saved us, they properly failed. That change in |
Goal is to lay groundwork to be able to fix #3331 and add new option to control which search path variables are added in modules by simplifying the code injecting environment variables to module files.
This PR should not alter the resulting module files to what is currently generated by EB. If it changes the list of environment variables it should have no effect (e.g. because those paths are empty).
Simplification of logic handling environment variables for module files:
(fixes directories that don't contain any library files shouldn't be added to
$LD_LIBRARY_PATH
#3504)top_level_file
attribute ofModuleEnvironmentVariable
lib64
that generate duplicate paths and need explicit exceptions with:lib64
are always ignored iflib64
is a symlink tolib
lib
are always ignored iflib
is a symlink tolib64
lib32
from list of library search pathsChangelog:
ModuleEnvironmentVariable
pseudo-dataclass toeasybuild.tools.modules
to hold definitions of environment variables for modulesModuleLoadEnvironment
singleton class toeasybuild.tools.modules
to hold environment definition for modules on loadEasyBlock.make_module_req_guess
in favor ofModuleLoadEnvironment
easybuild.framework.easyblock
to define possible linkage states of lib directoriesinstall_lib_symlink
attribute to EasyBlcok to keep track of symlink status between lib dirseasybuild.tools.config
that define known directories for binaries, libraries and headerseasyblock.make_module_req
by working with absolute paths instead