config: add a new concretizer
config section
The concretizer is going to grow to have many more configuration, and we really need some structured config for that. * We have the `config:concretizer` option that chooses the solver, but extending that is awkward (we'd need to replace a string with a `dict`) and the solver choice will be deprecated eventually. * We have the `concretization` option in environments, but it's not a top-level config section -- it's just for environments, and it also only admits a string right now. To avoid overlapping with either of these and to allow the most extensibility in the future, this adds a new `concretizer` config section that can be used in and outside of environments. There is only one option right now: `reuse`. This can expand to include other options later. Likely, we will soon deprecate `config:concretizer` and warn when the user doesn't use `clingo`, and we will eventually (sometime later) move the `together` / `separately` options from `concretization` into the top-level `concretizer` section. This commit just adds the new section and schema. Fully wiring it up is TBD.
This commit is contained in:

committed by
Greg Becker

parent
1903e45eec
commit
800ed16e7a
@@ -53,6 +53,7 @@
|
||||
import spack.schema
|
||||
import spack.schema.bootstrap
|
||||
import spack.schema.compilers
|
||||
import spack.schema.concretizer
|
||||
import spack.schema.config
|
||||
import spack.schema.env
|
||||
import spack.schema.mirrors
|
||||
@@ -69,6 +70,7 @@
|
||||
#: Dict from section names -> schema for that section
|
||||
section_schemas = {
|
||||
'compilers': spack.schema.compilers.schema,
|
||||
'concretizer': spack.schema.concretizer.schema,
|
||||
'mirrors': spack.schema.mirrors.schema,
|
||||
'repos': spack.schema.repos.schema,
|
||||
'packages': spack.schema.packages.schema,
|
||||
@@ -101,7 +103,7 @@
|
||||
'dirty': False,
|
||||
'build_jobs': min(16, cpus_available()),
|
||||
'build_stage': '$tempdir/spack-stage',
|
||||
'concretizer': 'original',
|
||||
'concretizer': 'clingo',
|
||||
}
|
||||
}
|
||||
|
||||
|
30
lib/spack/spack/schema/concretizer.py
Normal file
30
lib/spack/spack/schema/concretizer.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
|
||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
"""Schema for concretizer.yaml configuration file.
|
||||
|
||||
.. literalinclude:: _spack_root/lib/spack/spack/schema/concretizer.py
|
||||
:lines: 13-
|
||||
"""
|
||||
|
||||
properties = {
|
||||
'concretizer': {
|
||||
'type': 'object',
|
||||
'additionalProperties': False,
|
||||
'properties': {
|
||||
'reuse': {'type': 'boolean'},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#: Full schema with metadata
|
||||
schema = {
|
||||
'$schema': 'http://json-schema.org/draft-07/schema#',
|
||||
'title': 'Spack concretizer configuration file schema',
|
||||
'type': 'object',
|
||||
'additionalProperties': False,
|
||||
'properties': properties,
|
||||
}
|
@@ -2060,7 +2060,11 @@ def __init__(self):
|
||||
self.set_default_configuration()
|
||||
|
||||
def set_default_configuration(self):
|
||||
self.reuse = False
|
||||
# These properties are settable via spack configuration. `None`
|
||||
# means go with the configuration setting; user can override.
|
||||
self.reuse = None
|
||||
|
||||
# these are concretizer settings
|
||||
self.dump = ()
|
||||
self.models = 0
|
||||
self.timers = False
|
||||
@@ -2079,6 +2083,9 @@ def solve(self, specs):
|
||||
continue
|
||||
spack.spec.Spec.ensure_valid_variants(s)
|
||||
|
||||
if self.reuse is None:
|
||||
self.reuse = spack.config.get("concretizer:reuse", False)
|
||||
|
||||
setup = SpackSolverSetup(reuse=self.reuse, tests=self.tests)
|
||||
return driver.solve(
|
||||
setup, specs, self.dump, self.models, self.timers, self.stats
|
||||
|
Reference in New Issue
Block a user