Skip to content

simplify spack install behavior#35206

Merged
alalazo merged 4 commits intospack:developfrom
haampie:fix/explicit-installs-partial-env-install
Mar 20, 2023
Merged

simplify spack install behavior#35206
alalazo merged 4 commits intospack:developfrom
haampie:fix/explicit-installs-partial-env-install

Conversation

@haampie
Copy link
Copy Markdown
Member

@haampie haampie commented Jan 27, 2023

spack install still has surprising behavior in the context of 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, so generally it's useless,
    and if it works, it's doing redundant work.
  • 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 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...

@spackbot-app spackbot-app bot added commands core PR affects Spack core functionality environments tests General test capability(ies) labels Jan 27, 2023
@haampie haampie force-pushed the fix/explicit-installs-partial-env-install branch 6 times, most recently from 335363e to 006fe21 Compare January 27, 2023 15:56
@alalazo alalazo added this to the v0.20.0 milestone Feb 20, 2023
@haampie haampie force-pushed the fix/explicit-installs-partial-env-install branch 2 times, most recently from 4e2a5dd to 98a7295 Compare February 21, 2023 13:38
Copy link
Copy Markdown
Member

@alalazo alalazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@alalazo alalazo self-assigned this Mar 17, 2023
haampie and others added 2 commits March 17, 2023 12:15
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...
@haampie haampie force-pushed the fix/explicit-installs-partial-env-install branch from 7612407 to 561d194 Compare March 17, 2023 11:16
Copy link
Copy Markdown
Member

@alalazo alalazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alalazo alalazo merged commit 88d7802 into spack:develop Mar 20, 2023
@haampie haampie deleted the fix/explicit-installs-partial-env-install branch March 20, 2023 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands core PR affects Spack core functionality environments tests General test capability(ies)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants