[feat] Introduce new configuration syntax and validation schema #1128
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces only the syntax of the new (upcoming) configuration. The new configuration will be fully JSON compliant and will provide more flexibility.
The whole configuration is now stored (in its Python version) as a JSON object in the
site_configurationvariable. Systems, partitions and environments are now defined as JSON objects inside a JSON array. In the past, these were entries of Python dictionary, whose keys corresponded to the names of the represented objects (systems, partitions, etc.). The name is now a property instead. This will solve the issue of random initialization of systems (see #66). During system auto-detection, ReFrame will now try the system definitions in order and pick the configuration entry that was first matched.All logging configuration parameters will be moved inside the same
site_configurationJSON object, encoded inside different properties.New properties were added for scheduler-specific options and for general framework options, such as the search path for checks.
All base configuration entries (except the
systems) define atarget_systemsattribute, which is essentially a reference to the system or system/partition combination that this entry refers to. If not specified, the entry is valid for any system and system partitions. This replaces the scoped dictionaries exposed in the current configuration (although internally scoped dictionaries may be used).Default values
JSON schema allows to define default values of properties, but they play no role in the JSON validation process; the validated JSON instance is not changed, and there are some good reasons for that (see here). In order to access the default values, if specified, you would have to locate them inside the schema, which it would tie the code setting the defaults very much to the schema itself (not the JSON instance). For this reason, I introduce a
defaultsproperty in the schema that stores the defaults organized hierarchically per property as this should appear in the JSON instance. This will lead to a much more intuitive code when we read the configuration and we need to figure out any default values.A final note on the default values: I only specify default values if they are not
Noneor not empty lists.Finally, this PR provides an example configuration file (
schemas/settings.py) which corresponds to the old configuration found inunittests/resources/settings.py.For validating a configuration file, you can use this online JSON validator, where you can feed him with the schema: https://www.jsonschemavalidator.net/
Fixes #1113.