concretizer: update reuse: default to True (#41302)

This commit is contained in:
Greg Becker 2024-04-23 08:42:14 -07:00 committed by GitHub
parent d535124500
commit 978c20f35a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 16 additions and 8 deletions

View file

@ -15,7 +15,7 @@ concretizer:
# as possible, rather than building. If `false`, we'll always give you a fresh # as possible, rather than building. If `false`, we'll always give you a fresh
# concretization. If `dependencies`, we'll only reuse dependencies but # concretization. If `dependencies`, we'll only reuse dependencies but
# give you a fresh concretization for your root specs. # give you a fresh concretization for your root specs.
reuse: dependencies reuse: true
# Options that tune which targets are considered for concretization. The # Options that tune which targets are considered for concretization. The
# concretization process is very sensitive to the number targets, and the time # concretization process is very sensitive to the number targets, and the time
# needed to reach a solution increases noticeably with the number of targets # needed to reach a solution increases noticeably with the number of targets

View file

@ -3566,7 +3566,7 @@ def __init__(self):
# These properties are settable via spack configuration, and overridable # These properties are settable via spack configuration, and overridable
# by setting them directly as properties. # by setting them directly as properties.
self.reuse = spack.config.get("concretizer:reuse", False) self.reuse = spack.config.get("concretizer:reuse", True)
@staticmethod @staticmethod
def _check_input_and_extract_concrete_specs(specs): def _check_input_and_extract_concrete_specs(specs):

View file

@ -123,17 +123,18 @@ def test_root_and_dep_match_returns_root(mock_packages, mutable_mock_env_path):
@pytest.mark.parametrize( @pytest.mark.parametrize(
"arg,config", [("--reuse", True), ("--fresh", False), ("--reuse-deps", "dependencies")] "arg,conf", [("--reuse", True), ("--fresh", False), ("--reuse-deps", "dependencies")]
) )
def test_concretizer_arguments(mutable_config, mock_packages, arg, config): def test_concretizer_arguments(mutable_config, mock_packages, arg, conf):
"""Ensure that ConfigSetAction is doing the right thing.""" """Ensure that ConfigSetAction is doing the right thing."""
spec = spack.main.SpackCommand("spec") spec = spack.main.SpackCommand("spec")
assert spack.config.get("concretizer:reuse", None) is None assert spack.config.get("concretizer:reuse", None, scope="command_line") is None
spec(arg, "zlib") spec(arg, "zlib")
assert spack.config.get("concretizer:reuse", None) == config assert spack.config.get("concretizer:reuse", None) == conf
assert spack.config.get("concretizer:reuse", None, scope="command_line") == conf
def test_use_buildcache_type(): def test_use_buildcache_type():

View file

@ -1346,6 +1346,9 @@ def mock_fn(*args, **kwargs):
def test_reuse_installed_packages_when_package_def_changes( def test_reuse_installed_packages_when_package_def_changes(
self, context, mutable_database, repo_with_changing_recipe self, context, mutable_database, repo_with_changing_recipe
): ):
# test applies only with reuse turned off in concretizer
spack.config.set("concretizer:reuse", False)
# Install a spec # Install a spec
root = Spec("root").concretized() root = Spec("root").concretized()
dependency = root["changing"].copy() dependency = root["changing"].copy()
@ -2120,7 +2123,11 @@ def test_external_python_extension_find_dependency_from_installed(self, monkeypa
# install python external # install python external
python = Spec("python").concretized() python = Spec("python").concretized()
monkeypatch.setattr(spack.store.STORE.db, "query", lambda x: [python])
def query(*args, **kwargs):
return [python]
monkeypatch.setattr(spack.store.STORE.db, "query", query)
# ensure that we can't be faking this by getting it from config # ensure that we can't be faking this by getting it from config
external_conf.pop("python") external_conf.pop("python")

View file

@ -1,5 +1,5 @@
concretizer: concretizer:
# reuse is missing on purpose, see "test_concretizer_arguments" reuse: True
targets: targets:
granularity: microarchitectures granularity: microarchitectures
host_compatible: false host_compatible: false