Allow configuring spack load from modules.yaml#18260
Conversation
a71657d to
346fffa
Compare
becker33
left a comment
There was a problem hiding this comment.
We typically try to have the code default be the same as the etc/spack/defaults/*.yaml default. Can you create a dict named _default_inspections to serve as the default instead of {}?
I had originally planned to eventually factor this out into a separate config file that would be used by modules and by spack load and spack env activate, but I'm concerned that would be too many config files so I think you're right this is the way to go about it.
About moving this into some other place: Let's discuss that in a different issue/PR? |
|
In short: I agree with Greg As for why:
On the other hand, ideally the accidental deletion of the file wouldn't lead to abrupt terminations of Spack; therefore the code also sets defaults. So in this case I think the duplication is "for a good cause". Finally, regarding the module configuration default choice of
Could you add an example of this? Other questions/notes:
|
Let me see, if I understand that correctly:
Sounds fine to me!
Yes: If we can settle on
Linux: For Linux/macOS this is in
In some sense: Yes. In our setups, we want to use But anyway, having nice DRY code is a goal in itself. I think, the affected parts of spack were even desynced at some point. So this should improve maintainability.
The goal of this PR is really to only improve DRY/maintainability and keeping functionality nearly the same (well, improve |
Based on this I don't think this is about deduplication but rather control of the prefix inspections done by the
I don't think my examples contained a case of "improper" behavior: e.g. for modules, if you specify nothing then it makes sense to generate no modules. However, if you specify nothing for
Good point! That being said though I think if we are going to use the config to handle prefix inspections, then that means that we need to make sure that In short:
|
Okay, what am I missing? https://github.com/spack/spack/blob/develop/etc/spack/defaults/darwin/modules.yaml#L18-L21 That looks quite correct to me? It has the FALLBACK one, which AFAIK is the one good for macos? We don't yet support aix, right? For Linux it's also fine. I think, that points is done? |
346fffa to
bc4725d
Compare
done. |
|
It is a long-standing practice in Spack that the code defaults are expected to be exactly the defaults provided in That is not a criticism of the rest of this PR, I think it's a good change that we should be making. We just need to keep the code defaults updated in keeping with the changes. For example, if someone deleted |
|
I think then that the way you would address
while following #18260 (comment) is to explicitly add configuration that overrides |
That will satisfy the use case if I'm understanding correctly |
|
Well, I am again confused. For normal modules the in-code-default is I think, we should settle on two questions:
|
If you are referring to in
Generally they should behave the same although again #18260 (comment) explains at least one context where they should differ: the
We want Spack to do something sensible if this gets accidentally deleted somehow. We would not suggest that the user delete the file to change the merged configuration.
I think Greg's assertion is that if a user deletes, |
`spack load` didn't use the `prefix_inspections` from modules.yaml at all. All the other module systems use this mechanism to allow the user to configure those inspections. Let's take the prefix_inspections from modules.yaml configuration. If that is not available fall back to the old behaviour.
bc4725d to
1bf0e7f
Compare
|
Thanks for the explanation! So if I understand that correctly, for |
|
@ChristianTackeGSI Thanks for all the work on this PR! |
As of #18260, `spack load` and `spack env activate` now use `prefix_inspections` from the modules configuration to decide how to modify environment variables. This updates the modules configuration documentation to describe how to update environment variables with the `prefix_inspections` section. This also updates the `spack load` and environments documentation to refer to the new `prefix_inspections` documentation.
…pack#18260) `spack load` and `spack env activate` now use the prefix inspections defined in `modules.yaml`. This allows users to customize/override environment variable modifications if desired. If no `prefix_inspections` configuration is present, Spack uses the values in the default configuration. (cherry picked from commit d65f078)
…pack#18260) `spack load` and `spack env activate` now use the prefix inspections defined in `modules.yaml`. This allows users to customize/override environment variable modifications if desired. If no `prefix_inspections` configuration is present, Spack uses the values in the default configuration. (cherry picked from commit d65f078)
* releases/v0.16: (6003 commits) update CHANGELOG.md for v0.16.0 bump version number to 0.16.0 clingo: add `master` branch version (spack#19958) cmd: add `spack mark` command (spack#16662) spack test (spack#15702) Added -level_zero -rocm -opencl flags and sha256 for TAU v2.30. (spack#19962) Improve warning message for deprecated attributes in "packages.yaml" Documentation: spack load/environments prefix inspections (spack#19961) spack load/environments: allow customization of prefix inspections (spack#18260) spack containerize: allow users to customize the base image (spack#15028) concretizer: modified weights for providers and matching for externals concretizer: maximize the number of default values used for a single variant concretizer: don't require a provider for virtual deps if spec is external concretizer: spec_clauses() shouldn't emit node_compiler_hard for rule bodies. concretizer: don't generate rules for empty version lists concretizer: add a rule to avoid cycles in the graph of dependencies External packages have a consistent hash across different concretizers Don't fail if MV variants have a tuple as default value Fixup for target preferences Added unit tests to for regressions on open concretizer bugs ... # Conflicts: # .gitignore # lib/spack/spack/binary_distribution.py # lib/spack/spack/cmd/setup.py # lib/spack/spack/modules/common.py # var/spack/repos/builtin/packages/med/package.py # var/spack/repos/builtin/packages/mofem-cephas/package.py # var/spack/repos/builtin/packages/mofem-fracture-module/package.py # var/spack/repos/builtin/packages/mofem-users-modules/package.py # var/spack/repos/builtin/packages/mpich/package.py # var/spack/repos/builtin/packages/petsc/package.py # var/spack/repos/builtin/packages/python/package.py
spack loaddidn't use theprefix_inspectionsfrom modules.yaml at all. All the other module systems use this mechanism to allow the user to configure those inspections.Let's take the prefix_inspections from modules.yaml configuration. If that is not available fall back to the old behaviour.