Skip to content

filter out load statements that extend the $MODULEPATH to make the module being installed available#1016

Merged
boegel merged 19 commits intoeasybuilders:developfrom
boegel:fix_hmns_modpath_extension_loads
Sep 1, 2014
Merged

filter out load statements that extend the $MODULEPATH to make the module being installed available#1016
boegel merged 19 commits intoeasybuilders:developfrom
boegel:fix_hmns_modpath_extension_loads

Conversation

@boegel
Copy link
Copy Markdown
Member

@boegel boegel commented Aug 21, 2014

This is a fix for #996.

I tried very hard to make this a generic fix, i.e. one that should work with any hierarchical module naming scheme, not just the 2-level one using Core, Compiler/<comp_name>/<comp_version> and MPI/<comp_name>/<comp_version>/<mpi_name>/<mpi_version>.

Basically, what is being done now in make_module_dep is to figure out which dependency module is responsible for extending $MODULEPATH with the location where the module being installed will end up. That module is being excluded from the list of dependencies for which load statements are included in the generated module file.
This is done recursively: the module that makes the excluded dependency module being available is then also excluded, etc. Until the top of the hierarchy is reached, or none of the dependencies extends $MODULEPATH with the specified path.

This results in GCC/4.8.2 and OpenMPI/1.6.4 being excluded in a module built with a gompi or goolf toolchain, and should also work in other hierarchical module naming schemes.

@rtmclay: Does this make sense to you?

(CC: @ocaisa, @olavks, @pforai, @kcgthb, @geimer)

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Aug 21, 2014

@wpoely86: please review?

Comment thread easybuild/framework/easyblock.py Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor remark: puts these alphabetically?

@wpoely86
Copy link
Copy Markdown
Member

A first quick read and it seems fine to me.

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Aug 24, 2014

pushed a fix for an issue that @geimer ran into w.r.t. installing modules for toolchains under HierarchicalMNS, together with a unit tests that captures the issue. Thanks for reporting it @geimer!

@rtmclay
Copy link
Copy Markdown

rtmclay commented Aug 24, 2014

This fix makes sense to me.

Comment thread easybuild/tools/modules.py Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Something that caught my eye: the first \s in this regex uses +. Shouldn't that be *? (like with module use below?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, it should, but this works since currently "module load" statements are always guarded, and hence indented.

Will fix, nice catch!

@wpoely86
Copy link
Copy Markdown
Member

After a second read, still looks good.

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Aug 25, 2014

fixes pushed for remarks, I'll keep this on hold until @stdweird takes a look at this (per his request)

Comment thread easybuild/framework/easyblock.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why all the realpath calls? any particular issue encountered?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I ran into issues with symlinks with the unit tests (on OSX, /tmp is a symlink to /private/tmp for historical reasons). We're both comparing paths and taking path prefixes, using realpath basically gets rid of the symlinks.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Actually, using realpath shouldn't be necessary (anymore) since we're using os.path.samefile below.

Comment thread easybuild/tools/modules.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove the intermediate varaible and comment, it's confusing

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Aug 26, 2014

@stdweird: remarks fixed again

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do this? You remove them yourself in the function below? If you want to know if a module extends, a simple module in dict should do the trick?

Copy link
Copy Markdown
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 more general method, returning a dict that doesn't contain some of the modules in the original list may be easily considered a bug?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good point, it could.

@stdweird
Copy link
Copy Markdown
Contributor

minor remarks to improve readability, good to go otherwise. (it feels a bit brute force imho, but can't quite propose something better). no reason to delay this anyfurther, i doubt it has a real performnace impact.

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Sep 1, 2014

all remarks handled, I'm quite happy with this now...

Thanks for the feedback @rtmclay, @wpoely86, @stdweird!

boegel added a commit that referenced this pull request Sep 1, 2014
filter out load statements that extend the $MODULEPATH to make the module being installed available
@boegel boegel merged commit 441b80a into easybuilders:develop Sep 1, 2014
@boegel boegel deleted the fix_hmns_modpath_extension_loads branch September 1, 2014 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants