Enable and constrain reuse for GitVersion installations#43859
Enable and constrain reuse for GitVersion installations#43859psakievich merged 31 commits intospack:developfrom psakievich:psakiev/bug-gitref-reuse
Conversation
Currently the concretizer fails if you reuse a git ref version that has already been installed but modify the spec at all. See #38484 for futher diagnosis The issue here is that since there is no established provenance for these versions the highest weight they are currently assigned is that of prior install. Re-use checks then fail because the weight of the version is identical to the solver. Ironically, these versions are given the highest weights possible when specified on the CLI for the first time. They should only appear in a DAG if they are an exact match or if the user specifies them at the CLI. Therefore it makes sense to preserve their higher ordering. Getting this right is critical to moving all branch based versions to a pinned git-ref in the future.
|
@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/solver/asp.py
==> Running isort checks
isort checks were clean
==> Running black checks
reformatted lib/spack/spack/solver/asp.py
All done! ✨ 🍰 ✨
1 file reformatted.
black checks were clean
==> Running flake8 checks
flake8 checks were clean
==> Running mypy checks
lib/spack/spack/version/version_types.py:145: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
lib/spack/spack/version/version_types.py:452: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
lib/spack/spack/version/version_types.py:481: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
Found 3 errors in 1 file (checked 622 source files)
mypy found errors
I've updated the branch with style fixes. |
|
Interestingly this PR is currently giving the wrong reuse results for a standard case though: $ spack solve zlib-ng
==> Best of 4 considered solutions.
==> Optimization Criteria:
Priority Criterion Installed ToBuild
1 number of packages to build (vs. reuse) - 0
2 number of nodes from the same package - 0
3 requirement weight 0 0
4 deprecated versions used 0 0
5 version weight 5 0
6 number of non-default variants (roots) 0 0
7 preferred providers for roots 0 0
8 default values of variants not being used (roots) 0 0
9 number of non-default variants (non-roots) 0 0
10 preferred providers (non-roots) 0 0
11 compiler mismatches that are not from CLI 0 0
12 compiler mismatches that are not from CLI 0 0
13 non-preferred OS's 0 0
14 version badness 5 0
15 default values of variants not being used (non-roots) 0 0
16 non-preferred compilers 0 0
17 target mismatches 0 0
18 non-preferred targets 0 0
19 compiler mismatches (runtimes) 0 0
20 version badness (runtimes) 0 0
21 non-preferred targets (runtimes) 0 0
22 edge wiring 0 0
[+] [email protected]=2.1.5%[email protected]+compat+new_strategies+opt+pic+shared build_system=autotools arch=darwin-sonoma-m1
[+] ^[email protected]%[email protected]~guile build_system=generic arch=darwin-sonoma-m1
[+] ^gnuconfig@2022-09-17%[email protected] build_system=generic arch=darwin-sonoma-m1
$ spack find zlib-ng
-- darwin-sonoma-m1 / [email protected] ------------------------
[email protected] [email protected]=2.1.5
==> 2 installed packagesRe-use should be picking up the non-git ref install. According to how we have written |
Co-authored-by: Greg Becker <[email protected]>
|
I"m not so sure the issue with reuse I outlined is an issue. Basically, spack is picking the latest install that meets the spec requirements. If I do: $ spack install zlib-ng@3f35bfccff2d1dacdfe9844712be1e042d028700=2.1.5
[+] /Users/psakiev/scratch/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/gmake-4.4.1-yg5a2ohrgzyd532q2wnw5agfpzqgqfsb
[+] /Users/psakiev/scratch/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/gnuconfig-2022-09-17-7gytrfuudfw2tpponhl5i4x4xtmbb6wc
==> Installing zlib-ng-3f35bfccff2d1dacdfe9844712be1e042d028700=2.1.5-q4dw5qjorcvw7bwp7svflr6fnmd6e2lg [3/3]
==> No binary for zlib-ng-3f35bfccff2d1dacdfe9844712be1e042d028700=2.1.5-q4dw5qjorcvw7bwp7svflr6fnmd6e2lg found: installing from source
==> No patches needed for zlib-ng
==> zlib-ng: Executing phase: 'autoreconf'
==> zlib-ng: Executing phase: 'configure'
==> zlib-ng: Executing phase: 'build'
==> zlib-ng: Executing phase: 'install'
==> zlib-ng: Successfully installed zlib-ng-3f35bfccff2d1dacdfe9844712be1e042d028700=2.1.5-q4dw5qjorcvw7bwp7svflr6fnmd6e2lg
Stage: 10.90s. Autoreconf: 0.38s. Configure: 8.93s. Build: 1.59s. Install: 0.18s. Post-install: 0.05s. Total: 22.18s
[+] /Users/psakiev/scratch/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/zlib-ng-3f35bfccff2d1dacdfe9844712be1e042d028700_2.1.5-q4dw5qjorcvw7bwp7svflr6fnmd6e2lg
;As1082338:spack psakiev$ ng3f35bfccff2d1dacd@3f35bfccff2d1dacdfe9844712be1e042d028700=2.1.5
$ spack solve zlib-ng
==> Best of 5 considered solutions.
==> Optimization Criteria:
Priority Criterion Installed ToBuild
1 number of packages to build (vs. reuse) - 0
2 number of nodes from the same package - 0
3 requirement weight 0 0
4 deprecated versions used 0 0
5 version weight 5 0
6 number of non-default variants (roots) 0 0
7 preferred providers for roots 0 0
8 default values of variants not being used (roots) 0 0
9 number of non-default variants (non-roots) 0 0
10 preferred providers (non-roots) 0 0
11 compiler mismatches that are not from CLI 0 0
12 compiler mismatches that are not from CLI 0 0
13 non-preferred OS's 0 0
14 version badness 5 0
15 default values of variants not being used (non-roots) 0 0
16 non-preferred compilers 0 0
17 target mismatches 0 0
18 non-preferred targets 0 0
19 compiler mismatches (runtimes) 0 0
20 version badness (runtimes) 0 0
21 non-preferred targets (runtimes) 0 0
22 edge wiring 0 0
[+] zlib-ng@3f35bfccff2d1dacdfe9844712be1e042d028700=2.1.5%[email protected]+compat+new_strategies+opt+pic+shared build_system=autotools arch=darwin-sonoma-m1
[+] ^[email protected]%[email protected]~guile build_system=generic arch=darwin-sonoma-m1
[+] ^gnuconfig@2022-09-17%[email protected] build_system=generic arch=darwin-sonoma-m1It is picking the latest install, but to be fair to the concretizer, it is just the latest spec installed that meets the criteria I gave. This one I think could be wrong, given a $ spack solve zlib-ng@2
==> Best of 4 considered solutions.
==> Optimization Criteria:
Priority Criterion Installed ToBuild
1 number of packages to build (vs. reuse) - 0
2 number of nodes from the same package - 0
3 requirement weight 0 0
4 deprecated versions used 0 0
5 version weight 5 0
6 number of non-default variants (roots) 0 0
7 preferred providers for roots 0 0
8 default values of variants not being used (roots) 0 0
9 number of non-default variants (non-roots) 0 0
10 preferred providers (non-roots) 0 0
11 compiler mismatches that are not from CLI 0 0
12 compiler mismatches that are not from CLI 0 0
13 non-preferred OS's 0 0
14 version badness 5 0
15 default values of variants not being used (non-roots) 0 0
16 non-preferred compilers 0 0
17 target mismatches 0 0
18 non-preferred targets 0 0
19 compiler mismatches (runtimes) 0 0
20 version badness (runtimes) 0 0
21 non-preferred targets (runtimes) 0 0
22 edge wiring 0 0
[+] zlib-ng@3f35bfccff2d1dacdfe9844712be1e042d028700=2.1.5%[email protected]+compat+new_strategies+opt+pic+shared build_system=autotools arch=darwin-sonoma-m1
[+] ^[email protected]%[email protected]~guile build_system=generic arch=darwin-sonoma-m1
[+] ^gnuconfig@2022-09-17%[email protected] build_system=generic arch=darwin-sonoma-m1This one is most certainly wrong since $ spack solve [email protected]
==> Best of 3 considered solutions.
==> Optimization Criteria:
Priority Criterion Installed ToBuild
1 number of packages to build (vs. reuse) - 0
2 number of nodes from the same package - 0
3 requirement weight 0 0
4 deprecated versions used 0 0
5 version weight 5 0
6 number of non-default variants (roots) 0 0
7 preferred providers for roots 0 0
8 default values of variants not being used (roots) 0 0
9 number of non-default variants (non-roots) 0 0
10 preferred providers (non-roots) 0 0
11 compiler mismatches that are not from CLI 0 0
12 compiler mismatches that are not from CLI 0 0
13 non-preferred OS's 0 0
14 version badness 5 0
15 default values of variants not being used (non-roots) 0 0
16 non-preferred compilers 0 0
17 target mismatches 0 0
18 non-preferred targets 0 0
19 compiler mismatches (runtimes) 0 0
20 version badness (runtimes) 0 0
21 non-preferred targets (runtimes) 0 0
22 edge wiring 0 0
[+] zlib-ng@3f35bfccff2d1dacdfe9844712be1e042d028700=2.1.5%[email protected]+compat+new_strategies+opt+pic+shared build_system=autotools arch=darwin-sonoma-m1
[+] ^[email protected]%[email protected]~guile build_system=generic arch=darwin-sonoma-m1
[+] ^gnuconfig@2022-09-17%[email protected] build_system=generic arch=darwin-sonoma-m1Interested in thoughts? @tgamblin @becker33 @alalazo ? What are the conditions for re-use we would want to impose on |
|
Still thinking about this, but don't have a chance to work on it again yet. My current thought is we need to add a line to the concretizer that does something like: The issue is we can't just rely on satisfies b/c we need a |
|
Latest push fixes the issue above. Separate provenance for installs that are standard versions vs git versions allows the concretizer to prefer standard versions again. Now reuse won't consider git versions first unless they are the only thing installed, and this implicitly restores the requirement that $ spack solve --show solutions [email protected]=2.1.4 \
> && spack solve --show solutions [email protected]=2.1 \
> && spack solve --show solutions [email protected]=2.1.5 \
> && spack solve --show solutions [email protected]=2.1.5
- [email protected]=2.1.4%[email protected]+compat+new_strategies+opt+pic+shared build_system=autotools arch=darwin-sonoma-m1
[+] ^[email protected]%[email protected]~guile build_system=generic arch=darwin-sonoma-m1
[+] ^gnuconfig@2022-09-17%[email protected] build_system=generic arch=darwin-sonoma-m1
- [email protected]=2.1%[email protected]+compat+new_strategies+opt+pic+shared build_system=autotools arch=darwin-sonoma-m1
[+] ^[email protected]%[email protected]~guile build_system=generic arch=darwin-sonoma-m1
[+] ^gnuconfig@2022-09-17%[email protected] build_system=generic arch=darwin-sonoma-m1
- [email protected]=2.1.5%[email protected]+compat+new_strategies+opt+pic+shared build_system=autotools arch=darwin-sonoma-m1
[+] ^[email protected]%[email protected]~guile build_system=generic arch=darwin-sonoma-m1
[+] ^gnuconfig@2022-09-17%[email protected] build_system=generic arch=darwin-sonoma-m1
[+] [email protected]=2.1.5%[email protected]+compat+new_strategies+opt+pic+shared build_system=autotools arch=darwin-sonoma-m1
[+] ^[email protected]%[email protected]~guile build_system=generic arch=darwin-sonoma-m1
[+] ^gnuconfig@2022-09-17%[email protected] build_system=generic arch=darwin-sonoma-m1 |
|
Both of my tests are not working as expected. From a debugger it looks like the installs aren't getting stored in the database so I can't test re-use that way. |
|
Needed an additional mock due to a missing dependency on gcc-runtime in all mock packages. I confirmed that the tests I added fail on develop in the expected manner, and now pass with this PR. Questions for reviewers: |
I found out that what was happening was that the cxxstd of |
|
@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/solver/asp.py
lib/spack/spack/test/concretize.py
var/spack/repos/builtin.mock/packages/git-ref-package/package.py
==> Running isort checks
isort checks were clean
==> Running black checks
reformatted var/spack/repos/builtin.mock/packages/git-ref-package/package.py
All done! ✨ 🍰 ✨
1 file reformatted, 2 files left unchanged.
black checks were clean
==> Running flake8 checks
var/spack/repos/builtin.mock/packages/git-ref-package/package.py:6: [F401] 'spack.build_systems.autotools' imported but unused
var/spack/repos/builtin.mock/packages/git-ref-package/package.py:6: [F401] 'spack.build_systems.cmake' imported but unused
flake8 found errors
==> Running mypy checks
lib/spack/spack/version/version_types.py:145: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
lib/spack/spack/version/version_types.py:452: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
lib/spack/spack/version/version_types.py:481: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
Found 3 errors in 1 file (checked 625 source files)
mypy found errors
I've updated the branch with style fixes. |
|
@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/solver/asp.py
lib/spack/spack/test/concretize.py
var/spack/repos/builtin.mock/packages/git-ref-package/package.py
==> Running isort checks
isort checks were clean
==> Running black checks
reformatted lib/spack/spack/test/concretize.py
reformatted lib/spack/spack/solver/asp.py
All done! ✨ 🍰 ✨
2 files reformatted, 1 file left unchanged.
black checks were clean
==> Running flake8 checks
lib/spack/spack/test/concretize.py:2930: [E501] line too long (100 > 99 characters)
flake8 found errors
==> Running mypy checks
lib/spack/spack/version/version_types.py:145: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
lib/spack/spack/version/version_types.py:452: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
lib/spack/spack/version/version_types.py:481: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
Found 3 errors in 1 file (checked 625 source files)
mypy found errors
I've updated the branch with style fixes. |
This reverts commit 17223fc.
* Preserve higher weight for CLI git ref versions Currently the concretizer fails if you reuse a git ref version that has already been installed but modify the spec at all. See spack#38484 for futher diagnosis The issue here is that since there is no established provenance for these versions the highest weight they are currently assigned is that of prior install. Re-use checks then fail because the weight of the version is identical to the solver. Ironically, these versions are given the highest weights possible when specified on the CLI for the first time. They should only appear in a DAG if they are an exact match or if the user specifies them at the CLI. Therefore it makes sense to preserve their higher ordering. Getting this right is critical to moving all branch based versions to a pinned git-ref in the future. * [@spackbot] updating style on behalf of psakievich * Update lib/spack/spack/solver/asp.py Co-authored-by: Greg Becker <[email protected]> * Add provenance specific to git ref installs * Sensitvity to name that I could not track down * Add regression test * Adjust test * Add prefer standard unit-test * Style * Add required mock * Format and mark * Make unit-test case reproduce CLI investigation * Remove unnecessary mock package * [@spackbot] updating style on behalf of psakievich * Use already developed fixture * Add zlib-ng to mocks again * Remove accidental adds * Remove maintainer * [@spackbot] updating style on behalf of psakievich * Rename test file * [@spackbot] updating style on behalf of psakievich * Remove unused imports * Update tests * [@spackbot] updating style on behalf of psakievich * Style * Update lib/spack/spack/test/concretize.py Co-authored-by: Greg Becker <[email protected]> * Update solver rule * Duplicate installed rules for installed_git_version * Revert "Duplicate installed rules for installed_git_version" This reverts commit 17223fc. --------- Co-authored-by: psakievich <[email protected]> Co-authored-by: Greg Becker <[email protected]>
* Preserve higher weight for CLI git ref versions Currently the concretizer fails if you reuse a git ref version that has already been installed but modify the spec at all. See spack#38484 for futher diagnosis The issue here is that since there is no established provenance for these versions the highest weight they are currently assigned is that of prior install. Re-use checks then fail because the weight of the version is identical to the solver. Ironically, these versions are given the highest weights possible when specified on the CLI for the first time. They should only appear in a DAG if they are an exact match or if the user specifies them at the CLI. Therefore it makes sense to preserve their higher ordering. Getting this right is critical to moving all branch based versions to a pinned git-ref in the future. * [@spackbot] updating style on behalf of psakievich * Update lib/spack/spack/solver/asp.py Co-authored-by: Greg Becker <[email protected]> * Add provenance specific to git ref installs * Sensitvity to name that I could not track down * Add regression test * Adjust test * Add prefer standard unit-test * Style * Add required mock * Format and mark * Make unit-test case reproduce CLI investigation * Remove unnecessary mock package * [@spackbot] updating style on behalf of psakievich * Use already developed fixture * Add zlib-ng to mocks again * Remove accidental adds * Remove maintainer * [@spackbot] updating style on behalf of psakievich * Rename test file * [@spackbot] updating style on behalf of psakievich * Remove unused imports * Update tests * [@spackbot] updating style on behalf of psakievich * Style * Update lib/spack/spack/test/concretize.py Co-authored-by: Greg Becker <[email protected]> * Update solver rule * Duplicate installed rules for installed_git_version * Revert "Duplicate installed rules for installed_git_version" This reverts commit 17223fc. --------- Co-authored-by: psakievich <[email protected]> Co-authored-by: Greg Becker <[email protected]>
* Preserve higher weight for CLI git ref versions Currently the concretizer fails if you reuse a git ref version that has already been installed but modify the spec at all. See spack#38484 for futher diagnosis The issue here is that since there is no established provenance for these versions the highest weight they are currently assigned is that of prior install. Re-use checks then fail because the weight of the version is identical to the solver. Ironically, these versions are given the highest weights possible when specified on the CLI for the first time. They should only appear in a DAG if they are an exact match or if the user specifies them at the CLI. Therefore it makes sense to preserve their higher ordering. Getting this right is critical to moving all branch based versions to a pinned git-ref in the future. * [@spackbot] updating style on behalf of psakievich * Update lib/spack/spack/solver/asp.py Co-authored-by: Greg Becker <[email protected]> * Add provenance specific to git ref installs * Sensitvity to name that I could not track down * Add regression test * Adjust test * Add prefer standard unit-test * Style * Add required mock * Format and mark * Make unit-test case reproduce CLI investigation * Remove unnecessary mock package * [@spackbot] updating style on behalf of psakievich * Use already developed fixture * Add zlib-ng to mocks again * Remove accidental adds * Remove maintainer * [@spackbot] updating style on behalf of psakievich * Rename test file * [@spackbot] updating style on behalf of psakievich * Remove unused imports * Update tests * [@spackbot] updating style on behalf of psakievich * Style * Update lib/spack/spack/test/concretize.py Co-authored-by: Greg Becker <[email protected]> * Update solver rule * Duplicate installed rules for installed_git_version * Revert "Duplicate installed rules for installed_git_version" This reverts commit 17223fc. --------- Co-authored-by: psakievich <[email protected]> Co-authored-by: Greg Becker <[email protected]>
TLDR:
This PR fixes two issues:
GitVersionhad a prior install with the same versionGitVersionoverStandardVersionsif they were installed sooner and met thesatisfiescriteria. We want it to only pickGitVersionswhen the version is exactly equal.Original Post
Currently the concretizer fails if you reuse a git ref version that has already been installed but modify the spec at all.
See #38484 for futher diagnosis
The issue here is that since there is no established provenance for these versions the highest weight they are currently assigned is that of prior install. Re-use checks then fail because the weight of the version is identical to the solver.
Ironically, these versions are given the highest weights possible when specified on the CLI for the first time. They should only appear in a DAG if they are an exact match or if the user specifies them at the CLI. Therefore it makes sense to preserve their higher ordering.
Getting this right is critical to moving all branch based versions to a pinned git-ref in the future.