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.
80c9da8 to
b6c5457
Compare
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
b6c5457 to
f7be065
Compare
…default config Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
… ordering issues Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
…in old location if they are detected) Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
This reverts commit f7be065.
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
…d table Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
…section Signed-off-by: Peter Scheibel <scheibel1@llnl.gov>
becker33
left a comment
There was a problem hiding this comment.
The way I see it there are two real questions left:
- What is the best method for mitigating the pain for users for the change to the default user config path?
- Should
misc_cachebe under$state_homeor$cache_home?
I know we had some substantial conversations about question 2, but I went through all of the comments I could find on this PR and I couldn't find where those conversations were. Sorry to be dragging up something that we moved past a while ago, but luckily once we answer this we can very easily change it if needed.
The rest of the requests in this review are minor additions to the docs.
Overall I think this is very close to ready to merge.
| #. ``XDG_DATA_HOME/spack`` if XDG_DATA_HOME is set | ||
| #. Under the default for ``XDG_DATA_HOME``: ``~/.local/share/spack`` | ||
|
|
||
| ``config:locations:home`` / ``SPACK_HOME`` can be used to control all 3 of ``data_home``, ``cache_home``, and ``state_home``. |
There was a problem hiding this comment.
| ``config:locations:home`` / ``SPACK_HOME`` can be used to control all 3 of ``data_home``, ``cache_home``, and ``state_home``. | |
| ``config:locations:home`` / ``SPACK_HOME`` can be used to control all 3 of ``data_home``, ``cache_home``, and ``state_home``. | |
| For ``data_home``, the default is ``$spack_home/.local/share/spack``. | |
| For ``state_home``, the default is ``$spack_home/.local/state/spack``. | |
| For ``cache_home``, the default is ``$spack_home/.cache/spack``. |
| +-----------------+-----------+------------+------------+--------------------+ | ||
| | misc cache | | x | | | | ||
| +-----------------+-----------+------------+------------+--------------------+ | ||
| | test stages | | x | | | | ||
| +-----------------+-----------+------------+------------+--------------------+ | ||
| | licenses | x | | | | | ||
| +-----------------+-----------+------------+------------+--------------------+ | ||
| | config files | | | | x [#wheretable-2]_ | | ||
| +-----------------+-----------+------------+------------+--------------------+ | ||
|
|
||
| .. [#wheretable-1] cache_home is used as a backup, but Spack prefers to write into the users temp dir if it's available | ||
| .. [#wheretable-2] as discussed elsewhere in this section, config is controlled with :ref:`environment variables <local-config-overrides>` or with :ref:`include.yaml <include-yaml>` | ||
|
|
There was a problem hiding this comment.
| +-----------------+-----------+------------+------------+--------------------+ | |
| | misc cache | | x | | | | |
| +-----------------+-----------+------------+------------+--------------------+ | |
| | test stages | | x | | | | |
| +-----------------+-----------+------------+------------+--------------------+ | |
| | licenses | x | | | | | |
| +-----------------+-----------+------------+------------+--------------------+ | |
| | config files | | | | x [#wheretable-2]_ | | |
| +-----------------+-----------+------------+------------+--------------------+ | |
| .. [#wheretable-1] cache_home is used as a backup, but Spack prefers to write into the users temp dir if it's available | |
| .. [#wheretable-2] as discussed elsewhere in this section, config is controlled with :ref:`environment variables <local-config-overrides>` or with :ref:`include.yaml <include-yaml>` | |
| +-----------------+-----------+------------+------------+--------------------+ | |
| | misc cache | | x [#wheretable-2]_ | | | | |
| +-----------------+-----------+------------+------------+--------------------+ | |
| | test stages | | x | | | | |
| +-----------------+-----------+------------+------------+--------------------+ | |
| | licenses | x | | | | | |
| +-----------------+-----------+------------+------------+--------------------+ | |
| | config files | | | | x [#wheretable-3]_ | | |
| +-----------------+-----------+------------+------------+--------------------+ | |
| .. [#wheretable-1] cache_home is used as a backup, but Spack prefers to write into the users temp dir if it's available | |
| .. [#wheretable-2] The [XDG](https://specifications.freedesktop.org/basedir/latest/) specification requires that ``cache_home`` be removable. Spack caches are intended to be longer-lived, so they live in ``state_home`` instead. | |
| .. [#wheretable-3] as discussed elsewhere in this section, user-scope config is controlled with :ref:`environment variables <local-config-overrides>` or with :ref:`include.yaml <include-yaml>` to avoid recursion issues with configurable locations. For the locations of other config scopes and how to write to them instead, see :ref:`configuration scopes <configuration-scopes>`. | |
I think we either need to do this or move misc_cache back into cache_home -- I'm going to be going back to older comments and reminding myself why we thought it couldn't be in cache_home, because the actual XDG spec doesn't seem to have anything that would be a problem for us to put our cache in cache_home (and that would improve our sanity).
There was a problem hiding this comment.
I'm a big fan of doing this vs. putting misc_cache in cache_home
The official XDG spec (that you linked) doesn't have much to say about where you put anything (except for XDG_RUNTIME_DIR perhaps).
I was using https://wiki.debian.org/XDGBaseDirectorySpecification for guidance (linked in #49939) which I think has a very reasonable interpretation about what the categories mean (what is "data"? what is "state"? the table there defines these in terms of their lifetime, space usage, and sync/share requirements); because I find it reasonable, I think we should follow those definitions as well.
| - name: "user" | ||
| path_override_env_var: SPACK_USER_CONFIG_PATH | ||
| path: "~/.spack" | ||
| path: "~/.config/spack/" |
There was a problem hiding this comment.
I realize we don't have a good way to trigger a deprecation warning based on usage of the backwards-compat scope, so it may be hard to move users off of it. I see three options:
- Decide we don't need backwards compatibility (I don't like this one at all)
- Keep the new scope, add some ad-hoc way to trigger a deprecation warning if it's used
- Remove the backwards-compat scope, and add some manual logic in spack main to warn if
SPACK_USER_CONFIG_PATHis not set to~/.spack, and the user config scope path is not set to~/.spack, but the~/.spackdirectory exists and is not empty.
I think I was hasty with my review on Monday, and (3) is probably a better option than (2). What do you think? The primary reason that I prefer it is that I think it will be easier to eventually move away from in the long run (it can emit code for the user to set the user config path for themselves or recommend that they copy those files to ~/.config/spack to suppress the warning). Then in Spack 1.3 we can remove it entirely.
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