Compare commits

...

1 Commits

Author SHA1 Message Date
Harmen Stoppels
533a12aac6 Fix concretizer cache config schema and disable
This feature is not useful enough to enable by default. For a simple
spec I'm seeing 6 misses instead of 7 hits when running `spack spec
zlib`.

Also move config from `config:concretization_cache` to
`concretizer:cache` and rename `url` to `path` since no url can be
provided.
2025-03-11 12:23:42 +01:00
7 changed files with 18 additions and 18 deletions

View File

@ -95,6 +95,15 @@
"timeout": {"type": "integer", "minimum": 0}, "timeout": {"type": "integer", "minimum": 0},
"error_on_timeout": {"type": "boolean"}, "error_on_timeout": {"type": "boolean"},
"os_compatible": {"type": "object", "additionalProperties": {"type": "array"}}, "os_compatible": {"type": "object", "additionalProperties": {"type": "array"}},
"cache": {
"type": "object",
"properties": {
"enable": {"type": "boolean"},
"path": {"type": "string"},
"entry_limit": {"type": "integer", "minimum": 0},
"size_limit": {"type": "integer", "minimum": 0},
},
},
}, },
} }
} }

View File

@ -58,15 +58,6 @@
{"type": "string"}, # deprecated {"type": "string"}, # deprecated
] ]
}, },
"concretization_cache": {
"type": "object",
"properties": {
"enable": {"type": "boolean"},
"url": {"type": "string"},
"entry_limit": {"type": "integer", "minimum": 0},
"size_limit": {"type": "integer", "minimum": 0},
},
},
"install_hash_length": {"type": "integer", "minimum": 1}, "install_hash_length": {"type": "integer", "minimum": 1},
"install_path_scheme": {"type": "string"}, # deprecated "install_path_scheme": {"type": "string"}, # deprecated
"build_stage": { "build_stage": {

View File

@ -649,7 +649,7 @@ class ConcretizationCache:
def __init__(self, root: Union[str, None] = None): def __init__(self, root: Union[str, None] = None):
root = root or spack.config.get( root = root or spack.config.get(
"config:concretization_cache:url", spack.paths.default_conc_cache_path "concretizer:cache:path", spack.paths.default_conc_cache_path
) )
self.root = pathlib.Path(spack.util.path.canonicalize_path(root)) self.root = pathlib.Path(spack.util.path.canonicalize_path(root))
self._fc = FileCache(self.root) self._fc = FileCache(self.root)
@ -660,8 +660,8 @@ def cleanup(self):
"""Prunes the concretization cache according to configured size and entry """Prunes the concretization cache according to configured size and entry
count limits. Cleanup is done in FIFO ordering.""" count limits. Cleanup is done in FIFO ordering."""
# TODO: determine a better default # TODO: determine a better default
entry_limit = spack.config.get("config:concretization_cache:entry_limit", 1000) entry_limit = spack.config.get("concretizer:cache:entry_limit", 1000)
bytes_limit = spack.config.get("config:concretization_cache:size_limit", 3e8) bytes_limit = spack.config.get("concretizer:cache:size_limit", 3e8)
# lock the entire buildcache as we're removing a lot of data from the # lock the entire buildcache as we're removing a lot of data from the
# manifest and cache itself # manifest and cache itself
with self._fc.read_transaction(self._cache_manifest) as f: with self._fc.read_transaction(self._cache_manifest) as f:
@ -1215,7 +1215,7 @@ def solve(self, setup, specs, reuse=None, output=None, control=None, allow_depre
problem_repr += "\n" + f.read() problem_repr += "\n" + f.read()
result = None result = None
conc_cache_enabled = spack.config.get("config:concretization_cache:enable", True) conc_cache_enabled = spack.config.get("concretizer:cache:enable", True)
if conc_cache_enabled: if conc_cache_enabled:
result, concretization_stats = CONC_CACHE.fetch(problem_repr) result, concretization_stats = CONC_CACHE.fetch(problem_repr)

View File

@ -3278,7 +3278,7 @@ def _setup(self, specs, *, reuse=None, allow_deprecated=False):
# monkeypatch our forced determinism setup method into solver setup # monkeypatch our forced determinism setup method into solver setup
monkeypatch.setattr(spack.solver.asp.SpackSolverSetup, "setup", _setup) monkeypatch.setattr(spack.solver.asp.SpackSolverSetup, "setup", _setup)
assert spack.config.get("config:concretization_cache:enable") assert spack.config.get("concretizer:cache:enable")
# run one standard concretization to populate the cache and the setup method # run one standard concretization to populate the cache and the setup method
# memoization # memoization

View File

@ -353,10 +353,10 @@ def pytest_collection_modifyitems(config, items):
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def use_concretization_cache(mutable_config, tmpdir): def use_concretization_cache(mutable_config, tmpdir):
"""Enables the use of the concretization cache""" """Enables the use of the concretization cache"""
spack.config.set("config:concretization_cache:enable", True) spack.config.set("concretizer:cache:enable", True)
# ensure we have an isolated concretization cache # ensure we have an isolated concretization cache
new_conc_cache_loc = str(tmpdir.mkdir("concretization")) new_conc_cache_loc = str(tmpdir.mkdir("concretization"))
spack.config.set("config:concretization_cache:path", new_conc_cache_loc) spack.config.set("concretizer:cache:path", new_conc_cache_loc)
yield yield

View File

@ -5,3 +5,5 @@ concretizer:
host_compatible: false host_compatible: false
duplicates: duplicates:
strategy: minimal strategy: minimal
cache:
enable: false

View File

@ -14,5 +14,3 @@ config:
checksum: true checksum: true
dirty: false dirty: false
locks: {1} locks: {1}
concretization_cache:
enable: false