Make system config path overridable#26341
Conversation
On shared systems with a system-wide versioned programming environment
where the user can switch between different versions (and test the
latest the greatest when they feel like it), it's convenient to provide
a config for compilers and packages depending on the programming
environment version. It'd also be nice if the user could use their own
version of Spack on their favorite commit, and pick up config without
having to back up their user config and replacing it with something
temporarily when switching programming environment versions.
With this change, people managing the system can provide compilers.yaml
and packages.yaml versioned with the programming environment:
```
/path/to/programming/environment/1.2.3/{compilers,packages}.yaml
```
and set `SPACK_SYSTEM_CONFIG_PATH` to point to this dir.
In particular, on Cray systems this variable could be set in a module
called `spack-system-config`, and the user could opt in to use it, and
doesn't have to know about whatever programming environment verison they
are in.
As a bonus, if somebody would ever put Spack config files in
`/etc/spack`, the user can now opt out of that by setting
```
SPACK_SYSTEM_CONFIG_PATH=/non-existing/dir
```
a64d20f to
f210b1f
Compare
|
We spoke yesterday about this and I wanted to list the alternatives discussed:
Issues with this approach
WRT the latter point, I mentioned that if you didn't mind this being removed in the future that we could add it. However I'm trying to consider whether that's healthy for the Spack code base. |
The issue I see with this is that Spack has to be aware of these environments, which may be undesirable, especially if there are other distro's with similar concepts for versioned programming environments (I just know of CentOS which has software collections allowing you to do e.g. Environments including config based on a variable are a nice and generic solution, but I'm afraid that apart from forgetting about activating an environment, the learning curve is too high. New users start with
Agreed, I didn't want to introduce yet another config scope for instance :p the system scope seems like a perfect fit, and is generally not used anyways.
I think I can live with it, when system / user config would be dropped, people would be forced to use environment config, right? Btw, I just noticed that #23760 is essentially the same PR, but for user config. Also making that path overidable with an env var. Actually, it's the equivalent of #11951. Even the variable name is exactly Apparently many people want to override default paths with variables... the other PRs are from the perspective of the user working on multiple systems with a shared home folder, this PR is from the perspective of the system administrators providing multiple environments on a single system. Also note that the behavior of this PR was requested in this comment: #23760 (comment) and got an upvote ;) I think I'd be a big fan to have both these |
|
@scheibelp here's a reason why environment includes are a bit awkward: spack:
include:
- ${SPACK_SYSTEM_CONFIG_PATH}/config.yaml
- ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml
...If
So, basically I'll have to go back to my environment file and modify it, and I have to actually check what config files the system provides. That would not be necessary if Also, it seems like environment includes are not very well battle-tested... it's outputting daunting looking & redundant messages on concretization: |
Interesting: I would actually say that adding another scope would be an explicit interaction with the existing API, whereas reusing an existing scope for a different purpose is a new approach. As I think on it more, I would in fact like to make this scope explicit, e.g. (in Do you think you would be able to do that? Or would that not be suitable for your purposes? |
|
But then what would you call it 😅 SPACK_ENV_VARIABLE_CONFIG_BETWEEN_SITE_AND_USER_SCOPE=... (okay, I'm pushing it a bit, but to me it seems rather abitrary that the envirnonment-variable-based-scope happens to come between site & user, whereas defauls -> system -> site -> user -> command line make a lot of sense to me)
another interpretation is that it's a "bugfix" for the following:
there should be a way to opt out, and SPACK_[SYSTEM|USER]_CONFIG_PATH is a simple fix until those scopes are removed altogether. Overriding at the environment level with |
Don't tempt me: I love long variable names That being said, the scope itself I already proposed a name for: the
There is in fact some config that you might want to share with everyone on a system:
I agree with this, but I'm not sure how it's relevant because this PR doesn't do anything about the user scope; I don't think it should since there are other concerns (i.e. why we have it in the first place, our plans to get rid of it, and what we need to do before we get rid of it).
So while I don't know if I have a strong opinion on where it should reside exactly, those two considerations establish the boundaries. |
|
We discussed this today in https://github.com/spack/spack/wiki/Telcon:-2021-10-06 and it came up that using env variables to override scopes may be controversial (although I still think using an env variable to add a new scope should be OK). It was suggested we check in on slack with @tgamblin |
|
Regarding the above:
here are some thoughts I have which are adapted from my experience with the pants build tool. Multiple config sources precedencePants has no concept of "system" or "site" config, and instead manages precedence within config files very simply: there's no precedence hierarchy to search through, instead it:
And, importantly,
It seems like this describes a conflict arising from spack's currently-hardcoded config precedence. So attempting to apply that to the current issue, regarding:
I'm thinking that if we can specify a set of config files (for spack, likely a list of directories of config files) in order within an environment/config scope to denote the linear precedence, we could avoid confusion regarding what gets overridden. Proposal: configurable config precedenceRiffing off of @scheibelp's comment at #26341 (comment), I'm proposing the following. If site admins could do e.g. this in the site config: config:
config-files-after:
- extra-site-config-dir: "/etc/shared-stuff/.spack"(where and a user could do this in their user config: config:
config-files-before:
- shared-home-dir: "/home/shared-stuff/.spack"(where and a user could do this in their environment config: spack:
config-files-before:
- some-specific-site-config-dir-provided-by-site-admins: "/etc/special-site-config"
- this-repo-config: "./repo-config"(where these are processed immediately before the env config) Then we can enable all four of:
And importantly, none of this actually changes the precedence of config scopes, but merely allows specific config scopes to refer to more than one place--see below on bootstrap option parsing for why this is a useful result. Bootstrap option parsingAs in pants, I believe this would require processing the This proposal initially had just a
I think this is indeed better, since Shell interpolationRegarding this comment from @haampie:
we could even extend this syntax to support interpolating shell variables: spack:
config-files-before:
- this-env-config: "${MY_SPECIAL_SPACK_STUFF}/config-dir"
env_var_dirs:
- MY_SPECIAL_SPACK_STUFFwhere
|
|
@cosmicexplorer I was hoping for a quick fix 😆 (I'll read your message, but I was thinking more about a temporary solution until we have the system/config scopes dropped altogether, which seems to be one of the plans in other discussions) |
|
adding my support to @haampie 's stopgap approach: I wrote an almost-identical patch to our local install to allow the same Spack instance (on a sitewide filesystem) to get the appropriate |
|
closing in favor of #26735 |
On shared systems with a system-wide versioned programming environment
where the user can switch between different versions (and test the
latest the greatest when they feel like it), it's convenient to provide
a config for compilers and packages depending on the programming
environment version. It'd also be nice if the user could use their own
version of Spack on their favorite commit, and pick up config without
having to back up their user config and replacing it with something
temporarily when switching programming environment versions.
With this change, people managing the system can provide compilers.yaml
and packages.yaml versioned with the programming environment:
and set
SPACK_SYSTEM_CONFIG_PATHto point to this dir.In particular, on Cray systems this variable could be set in a module
called
spack-system-config, and the user could opt in to use it, anddoesn't have to know about whatever programming environment verison they
are in.
As a bonus, if somebody would ever put Spack config files in
/etc/spack, the user can now opt out of that by setting