concretizer: don't change concrete environments without --force#37438
concretizer: don't change concrete environments without --force#37438
--force#37438Conversation
|
I haven't looked at the code in detail, but it feels like a solid improvement to me, especially when you have a long list of specs already and just need to add a tiny package on top of it 👍 |
|
@spackbot fix style |
|
Let me see if I can fix that for you! |
|
I was able to run spack style --fix==> Running style checks on spack
selected: isort, black, flake8, mypy
==> Modified files
lib/spack/spack/environment/environment.py
lib/spack/spack/test/cmd/env.py
==> Running isort checks
isort checks were clean
==> Running black checks
reformatted lib/spack/spack/environment/environment.py
All done! ✨ 🍰 ✨
1 file reformatted, 1 file left unchanged.
black checks were clean
==> Running flake8 checks
flake8 checks were clean
==> Running mypy checks
Success: no issues found in 577 source files
mypy checks were clean
==> spack style checks were clean
I've updated the branch with style fixes. |
63695b2 to
db9b860
Compare
|
@alalazo this is a really big improvement, IMO. Can you take a look at this for 0.20? @becker33: I consolidated your original (duplicated) logic into a method and tweaked the docs and error messages a bit, but this looks great. See what you think of the changes. I think this will make people way happier with Spack environments. IMO it's ready to go pending a confirming review. |
--force
|
One thought on this (as a follow-on): I think it's actually good for Spack to fail fast if it would have to change any existing concrete specs in an env, but I also think that when using |
…7681) Two bugs came in from #37438 1. `unify: when_possible` was broken, because of an incorrect assertion. abstract/concrete spec pairs were compared against the results that were in the process of being computed, rather than against the previous results. 2. `unify: true` had an ordering bug that could mix the association between abstract and concrete specs - [x] 1 is resolved by creating a lookup from old concrete specs to old abstract specs, and we use that to associate the "new" concrete specs that happen to be the old ones with their abstract specs (since those are stripped out for concretization - [x] 2 is resolved by combining the new and old abstract as lists instead of combining them as sets. This is important because `set() | set()` does not make any ordering promises, even though set ordering is otherwise guaranteed in `python@3.7:`
…7681) Two bugs came in from #37438 1. `unify: when_possible` was broken, because of an incorrect assertion. abstract/concrete spec pairs were compared against the results that were in the process of being computed, rather than against the previous results. 2. `unify: true` had an ordering bug that could mix the association between abstract and concrete specs - [x] 1 is resolved by creating a lookup from old concrete specs to old abstract specs, and we use that to associate the "new" concrete specs that happen to be the old ones with their abstract specs (since those are stripped out for concretization - [x] 2 is resolved by combining the new and old abstract as lists instead of combining them as sets. This is important because `set() | set()` does not make any ordering promises, even though set ordering is otherwise guaranteed in `python@3.7:`
…7681) Two bugs came in from #37438 1. `unify: when_possible` was broken, because of an incorrect assertion. abstract/concrete spec pairs were compared against the results that were in the process of being computed, rather than against the previous results. 2. `unify: true` had an ordering bug that could mix the association between abstract and concrete specs - [x] 1 is resolved by creating a lookup from old concrete specs to old abstract specs, and we use that to associate the "new" concrete specs that happen to be the old ones with their abstract specs (since those are stripped out for concretization - [x] 2 is resolved by combining the new and old abstract as lists instead of combining them as sets. This is important because `set() | set()` does not make any ordering promises, even though set ordering is otherwise guaranteed in `python@3.7:`
…7681) Two bugs came in from #37438 1. `unify: when_possible` was broken, because of an incorrect assertion. abstract/concrete spec pairs were compared against the results that were in the process of being computed, rather than against the previous results. 2. `unify: true` had an ordering bug that could mix the association between abstract and concrete specs - [x] 1 is resolved by creating a lookup from old concrete specs to old abstract specs, and we use that to associate the "new" concrete specs that happen to be the old ones with their abstract specs (since those are stripped out for concretization - [x] 2 is resolved by combining the new and old abstract as lists instead of combining them as sets. This is important because `set() | set()` does not make any ordering promises, even though set ordering is otherwise guaranteed in `python@3.7:`
…7681) Two bugs came in from #37438 1. `unify: when_possible` was broken, because of an incorrect assertion. abstract/concrete spec pairs were compared against the results that were in the process of being computed, rather than against the previous results. 2. `unify: true` had an ordering bug that could mix the association between abstract and concrete specs - [x] 1 is resolved by creating a lookup from old concrete specs to old abstract specs, and we use that to associate the "new" concrete specs that happen to be the old ones with their abstract specs (since those are stripped out for concretization - [x] 2 is resolved by combining the new and old abstract as lists instead of combining them as sets. This is important because `set() | set()` does not make any ordering promises, even though set ordering is otherwise guaranteed in `python@3.7:`
|
@becker33 @alalazo I found an issue with this PR and I am not sure it is expected or not. It seems that it prevents me to install beta snapshots of the package (the tags that are not included into package.py). For example, following command but if use the code without these changes, it installs the package without any issue. Anyway, I need to have this capability since we are testing different versions of the ESMF package and it would be hard to add all the beta snapshots to the package.py. So, is there any other way to workaround the issue. Is this a bug? Any idea? |
…ack#37681) Two bugs came in from spack#37438 1. `unify: when_possible` was broken, because of an incorrect assertion. abstract/concrete spec pairs were compared against the results that were in the process of being computed, rather than against the previous results. 2. `unify: true` had an ordering bug that could mix the association between abstract and concrete specs - [x] 1 is resolved by creating a lookup from old concrete specs to old abstract specs, and we use that to associate the "new" concrete specs that happen to be the old ones with their abstract specs (since those are stripped out for concretization - [x] 2 is resolved by combining the new and old abstract as lists instead of combining them as sets. This is important because `set() | set()` does not make any ordering promises, even though set ordering is otherwise guaranteed in `python@3.7:`

Users generally don't want to change large chunks of their existing concrete environment, but Spack currently does that when using
concretizer:unify:true(the default) and ``concretizer:unify:when_possible`. Reconcretizing large environments can also be slow, as Spack has to start from scratch and solve everything again.We can do for
unify:trueandunify:when_possiblewhat we already do forunify:false: preserve the existing concrete environment state. This PR adds that functionality, and it lets you invalidate the existing concrete state withspack concretize -f. Now,spack concretizewill only concretize the new portions of the environment andspack concretize -freconcretizes the entire environment.