fix fake_module_environment context manager: make sure that cleanup of fake module is always done, even if an error was raised#4895
Merged
lexming merged 1 commit intoeasybuilders:developfrom May 26, 2025
Conversation
…f fake module is always done, even if an error was raised
boegel
added a commit
to boegel/easybuild-framework
that referenced
this pull request
May 26, 2025
boegel
added a commit
to boegel/easybuild-framework
that referenced
this pull request
May 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes a problem when
--parallel-extensions-installis used when extensions are involved that can't actually be installed in parallel, like withPerl-5.34.1-GCCcore-11.3.0.eb:EasyBuild will naively always try to install extensions in parallel when the
--parallel-extensions-installconfiguration setting is enabled, and only give up on that when aNotImplementedErroris raised; seeEasyBlock.install_all_extensions.A
NotImplementedErrorwill be raised by theinstall_extension_asyncmethod for extensions other than R packages.We should probably look into changing that, and only start installing extensions in parallel (via
EasyBlock.install_extensions_parallel) if all extensions that should be installed actually support it. If not, the extensions should just be installed sequentially (viaEasyBlock.install_extensions_sequential).Doing that correctly requires additional work though, probably an extra method in
Extensionthat declares whether installing in parallel is supported, or not.The acute problem here is that this leaves the environment in an inconsistent state, because the fake module that was loaded when the asynchronous installation of the 1st extension was being launched will not be cleaned up.
This makes Lmod quite unhappy as soon as an attempt is made to prepare the environment for the installation of the 2nd extension, see error above.
This fix in this PR makes sure that the fake module that was loaded is correctly cleaned up, and then there's no problem when the extensions are being installed.
edit: opened two issues to follow-up on things that were uncovered while working out this fix: