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

lift invalidating of module caches into helper method that can be used by easyblocks #2571

Merged
merged 7 commits into from
Sep 11, 2018

Conversation

boegel
Copy link
Member

@boegel boegel commented Sep 7, 2018

While testing the ModulesAlias easyblock (cfr. easybuilders/easybuild-easyblocks#1503), I noticed that the caching we do for module show commands is a bit too aggressive...

Module aliases show up in the output of module --terse avail in such a way that a fallback is needed to module show to recognize that a module alias is already in place.

The result of a module show command is cached the first time if it is run, but if multiple builds are being performed in the same session, this is a problem since the later build will see the outdated/incorrect result in a module alias was install in an early build.

For example, if Bazel has Java/1.8 specified as a dependency to be resolved by a module alias that still needs to be installed, the Java/1.8 alias that is in place by the time Bazel is installed will not be observed because the original module show Java/1.8 that came back empty is cached.

Clearing the module avail and module show caches before every new build is started deals with this issue.

@boegel boegel added the bug fix label Sep 7, 2018
@boegel boegel added this to the 3.7.0 milestone Sep 7, 2018
@boegel boegel requested a review from vanzod September 7, 2018 20:29
vanzod
vanzod previously approved these changes Sep 7, 2018
@boegel boegel changed the title reset module caches before every build reset module caches before every build (WIP) Sep 9, 2018
…idate_module_caches_for

lift relevant code block into 'invalidate_module_caches' helper method,
which can be used easily by easyblocks that overwrite make_module_step
@boegel boegel changed the title reset module caches before every build (WIP) lift invalidating of module caches into helper method that can be used by easyblocks Sep 9, 2018
@boegel
Copy link
Member Author

boegel commented Sep 9, 2018

After trying to come up with a test to verify the fix done in 3354ade, I noticed there wasn't actually a problem at all in framework...

The actual bug was that the ModuleAlias easyblock in easybuilders/easybuild-easyblocks#1503 was overwriting make_module_step but not calling invalidate_module_caches_for to ensure that the module caches were reset where needed.

So, I've rolled back the call to reset_module_caches between builds, and just lifted the calls to invalidate_module_caches_for into a helper method that can be leveraged by the ModuleAlias easyblock (see easybuilders/easybuild-easyblocks@f30e46c).

I've added the test I was working on as well, since it doesn't hurt; as far as I can tell there was no test yet that accurately verifies that the module caches are reset in between builds...

@boegel boegel added enhancement and removed bug fix labels Sep 9, 2018
@boegel boegel force-pushed the reset_module_caches branch 5 times, most recently from 71c8505 to 3faea7b Compare September 10, 2018 10:59
@@ -1106,7 +1106,7 @@ class Lmod(ModulesTool):
"""Interface to Lmod."""
COMMAND = 'lmod'
COMMAND_ENVIRONMENT = 'LMOD_CMD'
REQ_VERSION = '5.8'
REQ_VERSION = '6.6.3'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a substantial bump in the required Lmod version, but since 6.6.3 was released on Nov 13th 2016, I don't expect this to be a big problem.

A sufficiently recent Lmod version is needed in order for .modulerc to be picked up by Lmod, which is needed for the ModuleAlias easyblock (see easybuilders/easybuild-easyblocks#1503).

In theory, Lmod 6.0 should be sufficient for that, but several (unrelated) tests failed when using older Lmod 6.x versions.

Lmod 6.6.3 is the last 6.x release, so this way EasyBuild is still compatible with both Lmod 6.x & 7.x.

@easybuilders easybuilders deleted a comment from boegelbot Sep 11, 2018
@easybuilders easybuilders deleted a comment from boegelbot Sep 11, 2018
@easybuilders easybuilders deleted a comment from boegelbot Sep 11, 2018
@easybuilders easybuilders deleted a comment from boegelbot Sep 11, 2018
@easybuilders easybuilders deleted a comment from boegelbot Sep 11, 2018
@easybuilders easybuilders deleted a comment from boegelbot Sep 11, 2018
@easybuilders easybuilders deleted a comment from boegelbot Sep 11, 2018
@easybuilders easybuilders deleted a comment from boegelbot Sep 11, 2018
ocaisa
ocaisa previously approved these changes Sep 11, 2018
Copy link
Member

@ocaisa ocaisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM...waiting for travis

modulerc_txt = modgen.modulerc(module_version=module_version_spec)
one_moddir = os.path.join(self.test_installpath, 'modules', 'all', 'one')
write_file(os.path.join(one_moddir, '.modulerc'), modulerc_txt)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you repeat 1446 at this point (1.0.2 doesn't exist yet but the rc file does)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it won't make a difference because of the modules cache (the result for avail one/1.0 & show one/1.0 is cached).
And even if we clear the cache, it will still fail, since the underlying module doesn't exist yet (I'll add that to the test).

Copy link
Member

@ocaisa ocaisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, waiting on travis

@ocaisa ocaisa merged commit 0b79ca9 into easybuilders:develop Sep 11, 2018
@boegel boegel deleted the reset_module_caches branch September 11, 2018 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants