Skip to content

Bugfix: allow missing modules if they are blacklisted#13540

Merged
tgamblin merged 10 commits intospack:developfrom
scheibelp:bugfix/module-find-relaxed
Dec 5, 2019
Merged

Bugfix: allow missing modules if they are blacklisted#13540
tgamblin merged 10 commits intospack:developfrom
scheibelp:bugfix/module-find-relaxed

Conversation

@scheibelp
Copy link
Copy Markdown
Member

@scheibelp scheibelp commented Nov 1, 2019

Fixes #13346.

For spack module loads and spack module find, allow missing upstream modules (print a debug message vs. raising an error); also skip local modules if they are blacklisted.

Old behavior:

  • spack module find will report an error if the root spec's module or any dependency module does not exist (regardless of whether it is blacklisted)
  • spack module loads works the same

New behavior: the short version is that the module finding is now more lenient (especially for blacklisted modules):

  • spack module find will report an error if the root spec's module does not exist, unless
    • the module for the spec is blacklisted
      • For the root package, a debug message is output so that the user could check this with spack -d...
      • For any dependency package (when requesting dependency modules with spack module find) a message will not be reported (it's an error if the module is not blacklisted, but if it is blacklisted, the module is silently skipped)
    • the spec is associated with an upstream
      • instead of throwing exceptions when the module isn't find, the logic now prints out a debug-level message so the user has a hint of what is missing if they were expecting to see a module file for an upstream package
  • spack module loads works exactly the same way as the new spack module find, but informational messages are not generated for blacklisted packages

@scheibelp
Copy link
Copy Markdown
Member Author

@tgamblin this should add tests (e.g. for spack module find when there is a blacklist) but do you agree with the intended behavior in the PR description?

@tgamblin tgamblin requested a review from becker33 November 11, 2019 21:06
@tgamblin tgamblin requested a review from alalazo December 2, 2019 05:51
Copy link
Copy Markdown
Member

@tgamblin tgamblin left a comment

Choose a reason for hiding this comment

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

@scheibelp: LGTM, though I think it would be good if @alalazo also took a look.

My only request is more tests before we merge this.

…form the test with lmod for the module command test; for now I'm doing the latter because it's easier
@tgamblin
Copy link
Copy Markdown
Member

tgamblin commented Dec 3, 2019

@glennpj: does this fix #13346 for you?

Copy link
Copy Markdown
Member

@tgamblin tgamblin left a comment

Choose a reason for hiding this comment

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

@scheibelp: One minor change request: use return None instead of return for functions that are meant to return a value.

And one larger question that @becker33 made me think of: I am not sure these should just be debug messages. I suspect that if a user is using spack env loads, they will want to know that the behavior will be different from spack env activate for the same environment -- specifically that some packages will be omitted. My personal opinion on this is that the user should just activate the environment and not bother with modules in the first place, but I think with blacklisting it's not entirely intuitive.

How much work would it be to:

  1. Add commented lines to the loads file for each blacklisted module that would have otherwise been loaded.
  2. Emit one warning after spack env loads -- something like "modules for some packages do not exist due to blacklisting -- see <file> for details, and consider using spack env activate".

I think this is better behavior than (mostly) silently logging the missing modules.

@glennpj
Copy link
Copy Markdown
Contributor

glennpj commented Dec 3, 2019

@glennpj: does this fix #13346 for you?

Yes, it does.

…dules are omitted (blacklisted or missing from upstream); update 'module loads' output to explicitly mention missing modules in a comment
@scheibelp scheibelp changed the title [WIP] Bugfix: allow missing modules if they are blacklisted Bugfix: allow missing modules if they are blacklisted Dec 4, 2019
@scheibelp
Copy link
Copy Markdown
Member Author

@tgamblin changes are now addressed:

  • explicit return of None
  • updated docstring (per Bugfix: allow missing modules if they are blacklisted #13540 (comment))
  • loads output includes comments for missing (blacklisted/upstream) modules (note that the comment mentions that it could be blacklisted or that it could be missing from an upstream but doesn't distinguish) as well as an overall warning message

Copy link
Copy Markdown
Member

@tgamblin tgamblin left a comment

Choose a reason for hiding this comment

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

@scheibelp: Looks great to me! I think this will help people understand when/which modules are not present.

@tgamblin tgamblin merged commit e5f04f9 into spack:develop Dec 5, 2019
tgamblin pushed a commit that referenced this pull request Dec 5, 2019
`spack module loads` and `spack module find` previously failed if any upstream modules were missing.  This prevented it from being used with upstreams (or, really, any spack instance) that blacklisted modules.

This PR makes module finding is now more lenient (especially for blacklisted modules).

- `spack module find` now does not report an error if the spec is blacklisted
  - instead, it prints a single warning if any modules will be omitted from the loads file
  - It comments the missing modules out of the loads file so the user can see what's missing
  - Debug messages are also printed so users can check this with `spack -d...`

- also added tests for new functionality
tgamblin added a commit that referenced this pull request Dec 5, 2019
v0.13.2

This release contains major performance improvements for Spack environments, as well as some bugfixes and minor changes.

* allow missing modules if they are blacklisted (#13540)
* speed up environment activation (#13557)
* mirror path works for unknown versions (#13626)
* environments: don't try to modify run-env if a spec is not installed (#13589)
* use semicolons instead of newlines in module/python command (#13904)
* verify.py: os.path.exists exception handling (#13656)
* Document use of the maintainers field (#13479)
* bugfix with config caching (#13755)
* hwloc: added 'master' version pointing at the HEAD of the master branch (#13734)
* config option to allow gpg warning suppression (#13744)
* fix for relative symlinks when relocating binary packages (#13727)
* allow binary relocation of strings in relative binaries (#13724)
tgamblin added a commit that referenced this pull request Dec 5, 2019
v0.13.2

This release contains major performance improvements for Spack environments, as well as some bugfixes and minor changes.

* allow missing modules if they are blacklisted (#13540)
* speed up environment activation (#13557)
* mirror path works for unknown versions (#13626)
* environments: don't try to modify run-env if a spec is not installed (#13589)
* use semicolons instead of newlines in module/python command (#13904)
* verify.py: os.path.exists exception handling (#13656)
* Document use of the maintainers field (#13479)
* bugfix with config caching (#13755)
* hwloc: added 'master' version pointing at the HEAD of the master branch (#13734)
* config option to allow gpg warning suppression (#13744)
* fix for relative symlinks when relocating binary packages (#13727)
* allow binary relocation of strings in relative binaries (#13724)
samiilvonen pushed a commit to CSCfi/spack that referenced this pull request Jan 10, 2020
`spack module loads` and `spack module find` previously failed if any upstream modules were missing.  This prevented it from being used with upstreams (or, really, any spack instance) that blacklisted modules.

This PR makes module finding is now more lenient (especially for blacklisted modules).

- `spack module find` now does not report an error if the spec is blacklisted
  - instead, it prints a single warning if any modules will be omitted from the loads file
  - It comments the missing modules out of the loads file so the user can see what's missing
  - Debug messages are also printed so users can check this with `spack -d...`

- also added tests for new functionality
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.

spack env loads fails if there are blacklisted modules

5 participants