simplify spack install behavior#35206
Merged
alalazo merged 4 commits intospack:developfrom Mar 20, 2023
Merged
Conversation
335363e to
006fe21
Compare
4e2a5dd to
98a7295
Compare
alalazo
reviewed
Mar 17, 2023
Member
alalazo
left a comment
There was a problem hiding this comment.
I just had a first look at the code and basically LGTM. Will go over test driving the PR later. The main comment is that I think it would be worthwhile to move the "abstract spec matching" partial installation of an environment into the Environment class.
spack install still has surprising behavior for environments. This commit simplifies things a bit, so that we have the following: Example one: ``` spack install --add x y z ``` is equivalent to ``` spack add x y z spack concretize spack install --only-concrete ``` where `--only-concrete` installs without modifying spack.yaml/spack.lock Example two: ``` spack install ``` concretizes current spack.yaml if outdated and installs all specs. Example three: ``` spack install x y z ``` concretizes current spack.yaml if outdated and installs *only* concrete specs in the environment that match abstract specs `x`, `y`, or `z`. --- This is much better than the current behavior, which I have difficulty even explaining: - `spack install x y z` currently concretizes specs x, y, z *before* looking them up in the environment - `spack install --add x y z` can't make up its mind whether it should filter/restrict the concrete specs to x y z and add them as root specs *or* if they don't exist add them to the env -- but this fails when using unify: true, which is the default for environments. Very confusing...
7612407 to
561d194
Compare
alalazo
approved these changes
Mar 20, 2023
Member
alalazo
left a comment
There was a problem hiding this comment.
Code LGTM. Test driven on a couple of simple use cases (partial environment installation, automatic re-cocnretization when installing, etc.), and works as expected
Comment on lines
+1868
to
+1875
| def all_matching_specs(self, *specs: spack.spec.Spec) -> List[Spec]: | ||
| """Returns all concretized specs in the environment satisfying any of the input specs""" | ||
| key = lambda s: s.dag_hash() | ||
| return [ | ||
| s | ||
| for s in spack.traverse.traverse_nodes(self.concrete_roots(), key=key) | ||
| if any(s.satisfies(t) for t in specs) | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
spack installstill has surprising behavior in the context of environments.This commit simplifies things a bit, so that we have the following:
Example one:
is equivalent to
where
--only-concreteinstalls without modifying spack.yaml/spack.lockExample two:
concretizes current spack.yaml if outdated and installs all specs.
Example three:
concretizes current spack.yaml if outdated and installs only concrete
specs in the environment that match abstract specs
x,y, orz.This is much better than the current behavior, which I have difficulty
even explaining:
spack install x y zcurrently concretizes specs x, y, z beforelooking them up in the environment, so generally it's useless,
and if it works, it's doing redundant work.
spack install --add x y zcan't make up its mind whether it shouldfilter/restrict the concrete specs to x y z and add them as root specs
or when they don't exist add them to the env -- but this fails when
using unify: true, which is the default for environments. Very
confusing...