Conversation
|
I've driven this around extensively, poking in particular at upstream use cases. It would appear that upstreams has advanced enough since #11871 that a number of problems fixed in the original patch set are no longer an issue. So far as upstreams working without configuration, I also noticed that a shared installation could configure itself as an upstream in $spack/etc/spack/defaults/upstreams.yaml, and that just worked for both the user managing that spack instance and a different user loading that spack instance. Neat! Probably not the greatest way to do it, but allows for doing something close until we have time to do another PR. |
FWIW I added the
In other words, I didn't expect what you did to work. We might want to prevent that from happening, because I'm not sure what is actually going on when the upstream is the same as the root. (this is mentioned in the subsection "New config scopes for user/admin interaction"; it would also be possible to implicitly omit an upstream if it matches the root) |
|
I generally think this is very useful, and is specifically useful for pip/apt. What do we need to do to get this beyond a draft? What can I do to help? |
|
It would be good to add to the documentation for scopes. Here's something I wrote for configuration.rst, but would go much better in this PR: and |
psakievich
left a comment
There was a problem hiding this comment.
Lot's of great work here. Specific comments are added for sections I have design concerns on. I would also like to see some unit-tests for:
- XDG mapping/fall back behaviors. Seems like a lot of permutations are possible here. Seeing the tests would help me to spot and/or understand corner cases.
- site admin stuff (I'm kind of just trusting this works as intended without a use case or docs in front of me)
- file permission issue handling for users interfacing with an admin install
IMO Those seem to be the main new features that are not tested in the current test-suite.
… configuration doc section
… to 30634) Signed-off-by: Peter Scheibel <[email protected]>
Signed-off-by: Peter Scheibel <[email protected]>
Signed-off-by: Peter Scheibel <[email protected]>
Signed-off-by: Peter Scheibel <[email protected]>
Signed-off-by: Peter Scheibel <[email protected]>
Signed-off-by: Peter Scheibel <[email protected]>
Signed-off-by: Peter Scheibel <[email protected]>
Signed-off-by: Peter Scheibel <[email protected]>
Signed-off-by: Peter Scheibel <[email protected]>
Signed-off-by: Peter Scheibel <[email protected]>
80c9da8 to
b6c5457
Compare
Signed-off-by: Peter Scheibel <[email protected]>
b6c5457 to
f7be065
Compare
…default config Signed-off-by: Peter Scheibel <[email protected]>
Closes #15939
Closes #49939
Closes #11871
This is a redo of #11871, which aims to make Spack pip/apt-installable. Use cases are described in detail here (they are numbered, and this PR description may refer to them like "U1"), along with parts of 11871 that are not handled here.
Moving Spack-generated artifacts outside of
$spackThe biggest blocker to creating a shared spack instance is that Spack will default to writing data into its own prefix. For new clones of Spack, this PR moves all generated files out of the cloned directory and into
~. This includes:For old clones:
$spackdirectories.~and an old spack instancegit pulls this logic, the old instance will start using~. A warning is generated in this case1-3 are large. Before this PR there were config options to relocate each of these individually (and those still take precedence). This PR offers additional mechanisms to set a single env var or config option in order to relocate all of them together.
Controlling install location
This PR establishes the following order:
config:install_tree:root:...SPACK_DATA_HOMEenv var if that is setSPACK_HOMEenv var if that is setconfig:locations:dataif that is setconfig:locations:homeif that is setXDG_DATA_HOMEenv var if that is setXDG_DATA_HOME:~/.local/share/spackIf an older clone of spack pulls this, and has existing installs in
$spack/opt/spack(the old default), then:Other notes:
config:install_tree:rootso that users who dospack config get configwill see that setting, but it uses a special default variable that effectively behaves as if it were unset.config:environments_rootconfig:source_cache)SPACK_DATA_HOME,XDG_DATA_HOMEorconfig:locations:data$spackor~before can be relocated by settingSPACK_HOMEorconfig:locations:home, except for the user config scopeetc/spack/include.yamlsetspath: "$spack_home/.config/spack/"for the user scope. In order to influence this, the user must set theSPACK_HOMEenv var, or they must setconfig:locations:homeat a scope that is lower priority than thespackscope (right now that is awkward - see: Shared spack #47615 (comment))include:config to reference config-based location variables causes too many headachesconfig:locations:disable_env:true(i.e. 2, 3, 6 will be ignored).Admin management, pip-installed spack
$spack. As of now, everything goes into~. I think this default behavior will be sufficient to supportpip installed spackinclude:config in thespack scope:upstreams:xconfigwhen: SPACK_ADMIN not in envinstall_tree:root:xconfigwhen: SPACK_ADMIN in envavoiding
~Before this PR, you could do
and nothing would be read from or written to ~
With this PR, that would not be enough. Some ways to do that here:
spack isolatecommand that you can run to configure spack to write into$spackSPACK_HOME=x SPACK_USER_CONFIG_PATH=x/config, everything will be written to xSPACK_HOME=x SPACK_DISABLE_LOCAL_CONFIG=1config:locations:dataoutside of ~, this will relocate everything that takes up significant space (envs, installs, cached downloads)To completely move everything, in an env you can do:
Users who have write access to $spack can do
XDG compliance
Everything that was written into
~/.spackis now relocated to XDG-compliant alternatives:~/.config/spack)~/.local/state/spack$SPACK_USER_CACHE_PATH(highest priority),$SPACK_STATE_HOME, and$XDG_STATE_HOMEEverything moving out of
$spackis moving into XDG-compliant default locations under~.$SPACK_DATA_HOME/gpg-keys$SPACK_DATA_HOME(e.g.$SPACK_DATA_HOME/lmod)See also: #49939
Crosstalk between spack instances
config:misc_cachestill exists, so users can share a single misc cache among multiple instances of spack~/.config/spackUse cases/considerations
All items here are addressed, although there is some friction with [4]
a. sub-case, with
--user(i.e. user may have write permissions to the install location)a. but users might choose to clone spack themselves
b. and they may or may not want to use an admin-curated upstream: it should be possible for users to get an upstream DB by default from an admin without running any extra commands
~may or may not have significant storage spacea. admin should be able to define config that only applies to users, not admins
b. Multiple admins may all want to share a config, but not provide that config to an end-user
c. users may want their install location to differ on a per-spack basis (but still live outside of the spack prefix)
a. new
git clones of spackb.
git pulls in existing clones (and e.g. should be able to use gpg keys)c. Discarding a pre-existing download cache is not a problem
TODOs
Maybe TODOs
it may be useful to strip out vendored libs (i.e. code in.lib/spack/external/) and handle it w/requirements.txtThat is possibly complicated if the versions we vendor (intended to support back to Python 3.6) are no longer supported/availablespack.vendornamespace, so long as those top-level modules do not themselves require vendored libs, this would prevent vendored Spack python deps from interfering with imports.Things not translated from #11871
If prefixed w/ "drop", I think we can skip it entirely
apt/pip-installablespack --install-tree=... installstore.pydepends on config (so this would introduce a cyclic dependency).Other changes
Not essential to this PR, but related to other changes made here
sys.addaudithook); it is enabled with--guard-writes-into-spack