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

Use one argument 'module swap' statements in Tcl modulefiles (required by Modules 4.2.3+) #3397

Merged
merged 6 commits into from
Aug 27, 2020

Conversation

welucas2
Copy link
Contributor

@welucas2 welucas2 commented Aug 4, 2020

This should address #3396 by generating modulefiles which use module swap commands with the only argument being the module to load in. module is intelligent enough to know which module should be unloaded, and this doesn't result in conflicting modules (and so unusable modulefiles) which occurs with Modules 4.2.3 and newer.

edit: fixes #3396

@welucas2
Copy link
Contributor Author

welucas2 commented Aug 4, 2020

Looks like it fails with older Modules versions. Something else is needed?

@@ -962,7 +962,7 @@ def swap_module(self, mod_name_out, mod_name_in, guarded=True):
:param mod_name_in: name of module to load (swap in)
:param guarded: guard 'swap' statement, fall back to 'load' if module being swapped out is not loaded
"""
body = "module swap %s %s" % (mod_name_out, mod_name_in)
body = "module swap %s" % (mod_name_in)
Copy link
Member

Choose a reason for hiding this comment

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

@welucas2 It's probably worth adding a comment above here to explain why we use single argument swap commands.

Before we didn't have a good reason to use swap foo foo/<version> rather than swap foo/<version> I think, but now we clearly do, so it's worth mentioning that I think...

I'll also check with the other module tools we support whether single argument swap works for those, I'm not sure that's covered by the test suite right now (we just do a text comparison of the generated module file in the tests currently).

@boegel boegel changed the title Use one argument module swap in Tcl modulefiles Use one argument 'module swap' statement in Tcl modulefiles (required by Modules 4.2.3+) Aug 5, 2020
@boegel boegel changed the title Use one argument 'module swap' statement in Tcl modulefiles (required by Modules 4.2.3+) Use one argument 'module swap' statements in Tcl modulefiles (required by Modules 4.2.3+) Aug 5, 2020
@boegel boegel added the bug fix label Aug 5, 2020
@boegel boegel added this to the next release (4.2.3?) milestone Aug 5, 2020
Copy link
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

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

I've updated this PR with a small update to test_swap that verifies for which module tools the single-argument swap works.

It's fine for everything except for the ancient Tcl-only modules tool version 1.x, which we don't really care about anymore (I'll deprecate the support for that in a separate PR).

I'll go ahead and merge this PR as soon as CI gives the green light, thanks for diving into this yourself @welucas2!

@boegel
Copy link
Member

boegel commented Aug 27, 2020

I've also verified that single-arg swap in Cray* toolchain modules works fine on Piz Daint (cc @victorusu, @gppezzi), so I'll go ahead and merge this.

Thanks again @welucas2!

@boegel boegel merged commit 2aa7bdf into easybuilders:develop Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't generate working Tcl modulefiles with Modules 4.2.3+
2 participants