Skip to content

Commit f17c7be

Browse files
authored
Concretization Cache: Refactor + manifest testing (#49589)
#48198 Introduces the concretization cache, and associated manifest. However, it only added testing for the cache itself, not the manifest or cleanup procedures. This PR: - [x] Adds tests for the manifest and cleanup - [x] Refactors the manifest to update correctly - [x] Refactors the cache to store base32 hashes like the rest of Spack's hashes - [x] gzips the cache entries for a smaller memory footprint `FileCache` class was refactored into an abstract base `Cache` class which provides the general cache read/write transaction interface, and a `FileCache` and `DirectoryCache` child classes, `FileCache` which should be functionally identical to the `FileCache` class pre refactor, deals with caches at the individual file level, and `DirectoryCache`, which is mean to provide a directory level or "bucket" caching level.
1 parent 53e5e20 commit f17c7be

13 files changed

Lines changed: 520 additions & 387 deletions

File tree

etc/spack/defaults/concretizer.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,7 @@ concretizer:
8989
# Static analysis may reduce the concretization time by generating smaller ASP problems, in
9090
# cases where there are requirements that prevent part of the search space to be explored.
9191
static_analysis: false
92+
93+
concretization_cache:
94+
enable: true
95+
url: $user_cache_path/concretization

lib/spack/docs/config_yaml.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ When ``false`` or ommitted, all concretization requests will be performed from s
363363
Path to the location where Spack will root the concretization cache. Currently this only supports
364364
paths on the local filesystem.
365365

366-
Default location is under the :ref:`Misc Cache` at: ``$misc_cache/concretization``
366+
Default location is under the :ref:`Misc Cache` at: ``$user_cache_path/concretization``
367367

368368
------------------------------------
369369
``concretization_cache:entry_limit``

lib/spack/llnl/util/filesystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2892,7 +2892,7 @@ def temporary_file_position(stream):
28922892

28932893

28942894
@contextmanager
2895-
def current_file_position(stream: IO[str], loc: int, relative_to=io.SEEK_CUR):
2895+
def current_file_position(stream: IO, loc: int, relative_to=io.SEEK_CUR):
28962896
with temporary_file_position(stream):
28972897
stream.seek(loc, relative_to)
28982898
yield

lib/spack/spack/schema/concretizer.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@
9595
"timeout": {"type": "integer", "minimum": 0},
9696
"error_on_timeout": {"type": "boolean"},
9797
"os_compatible": {"type": "object", "additionalProperties": {"type": "array"}},
98+
"concretization_cache": {
99+
"type": "object",
100+
"properties": {
101+
"enable": {"type": "boolean"},
102+
"url": {"type": "string"},
103+
"entry_limit": {"type": "integer", "minimum": 0},
104+
"size_limit": {"type": "integer", "minimum": 0},
105+
},
106+
},
98107
},
99108
}
100109
}

lib/spack/spack/schema/config.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,6 @@
5858
{"type": "string"}, # deprecated
5959
]
6060
},
61-
"concretization_cache": {
62-
"type": "object",
63-
"properties": {
64-
"enable": {"type": "boolean"},
65-
"url": {"type": "string"},
66-
"entry_limit": {"type": "integer", "minimum": 0},
67-
"size_limit": {"type": "integer", "minimum": 0},
68-
},
69-
},
7061
"install_hash_length": {"type": "integer", "minimum": 1},
7162
"install_path_scheme": {"type": "string"}, # deprecated
7263
"build_stage": {

0 commit comments

Comments
 (0)