Allow users to specify root env dir#32836
Allow users to specify root env dir#32836becker33 merged 66 commits intospack:developfrom psakievich:f/env-location
Conversation
Environments managed by spack have some advantages over anonymous Environments but they are tucked away inside spack's directory tree. This PR gives users the ability to specify where the environments should live. See #32823
Co-authored-by: Greg Becker <[email protected]> Add back path canonicalization
|
Closes #32823 |
tldahlgren
left a comment
There was a problem hiding this comment.
Switching from comment to request changes due to the typos needing fixed.
Co-authored-by: Tamara Dahlgren <[email protected]>
Co-authored-by: Tamara Dahlgren <[email protected]>
|
@tldahlgren I thought about having a list of directories. This is a good question. It complicated things a bit which is why I didn't pursue it. One thing I'm not sure how to handle is where we add the new environments to. Thinking further, if we treat this like a stack then we could just add environments to the directory at the top of the stack. Another option could be to only allow two entries: the default directory and allow for a single option from the config. I think I like the second option more. I'm not sure the utility of expanding beyond a single user location and the default location. In the current form the already created environments in the default directory would become anonymous environments. Speaking for myself I typically only use one or the other (registered vs anonymous) in a given spack instance but that may not be reflective of the broader community. |
|
Hmm another potential issue for this is if the environments have the same name in both locations |
|
@tldahlgren and @becker33 this is ready finally. After #34758 some of the logic regarding environment paths and avoiding circular imports was cleaned up. Most of the hang up on this was due to tests using the same |
becker33
left a comment
There was a problem hiding this comment.
Besides the one inline comment, everything looks good to me. I agree with your assessment on slack that it's confusing that this is coming up for this PR and not previously. My best guess without fully diving in to debug it is that previously things "just happened" to work because environments would coincidentally wind up in the same place, even though they weren't being mocked in a way that was thread safe.
| root: $TMP_DIR/install | ||
| misc_cache: $$user_cache_path/cache | ||
| source_cache: $$user_cache_path/source | ||
| environments_root: $TMP_DIR/envs |
There was a problem hiding this comment.
I'm having trouble tracking why this change is necessary.
There was a problem hiding this comment.
That script is used to separate the unit tests when run in parallel. It ensures that each test runner gets its own separate spack environment so they don't tromp each other. If the environments_root defaults to being under user_cache_path or something then it's unnecessary, but if it's in the spack_root by default or something like that then the script needs to put it somewhere else.
There was a problem hiding this comment.
Yeah @psakievich and I came to the conclusion that this probably isn't technically necessary since all of the environment tests use a mock environment root anyway, but that we should keep it to ensure future tests are separated for parallel execution.
There was a problem hiding this comment.
Sounds right to me. The script is meant to be a safety net and a workaround for all the tests that haven't been converted yet. It's also oddly useful as a way to do one-off testing without messing up a current environment just on the command line, so having it there helps with that kind of use.
becker33
left a comment
There was a problem hiding this comment.
I'm sorry this became such an unholy pain to get ready to merge
tldahlgren
left a comment
There was a problem hiding this comment.
LGTM. Just a couple of questions.
tldahlgren
left a comment
There was a problem hiding this comment.
Would prefer the 'named' -> 'managed' comment change but won't require the change.
docs: consistently use 'managed environment' over 'named ...'
* Allow users to specify root env dir Environments managed by spack have some advantages over anonymous Environments but they are tucked away inside spack's directory tree. This PR gives users the ability to specify where the environments should live. See spack#32823 This is also taken as an opportunity to ensure that all references are to "managed environments", rather than "named environments". Prior to this PR some references to the latter persisted. Co-authored-by: Tom Scogland <[email protected]> Co-authored-by: Tamara Dahlgren <[email protected]> Co-authored-by: Gregory Becker <[email protected]> Conflicts: lib/spack/spack/test/cmd/env.py lib/spack/spack/test/env.py
* Allow users to specify root env dir Environments managed by spack have some advantages over anonymous Environments but they are tucked away inside spack's directory tree. This PR gives users the ability to specify where the environments should live. See spack#32823 This is also taken as an opportunity to ensure that all references are to "managed environments", rather than "named environments". Prior to this PR some references to the latter persisted. Co-authored-by: Tom Scogland <[email protected]> Co-authored-by: Tamara Dahlgren <[email protected]> Co-authored-by: Gregory Becker <[email protected]>
Environments managed by spack have some advantages over anonymous Environments but they are tucked away inside spack's directory tree. This PR gives users the ability to specify where the environments should live.
See #32823