Skip to content

Conversation

@vkarak
Copy link
Contributor

@vkarak vkarak commented Jan 22, 2020

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_configuration variable. 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_configuration JSON 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 a target_systems attribute, 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 defaults property 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 None or not empty lists.

Finally, this PR provides an example configuration file (schemas/settings.py) which corresponds to the old configuration found in unittests/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.

- This commit adds also a temporary settings file that showcases how the new
  configuration looks like. It corresponds to the actual
  `unittests/resources/settings.py`.
- The new settings file validates with the schema.
@codecov-io
Copy link

codecov-io commented Jan 22, 2020

Codecov Report

Merging #1128 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1128      +/-   ##
==========================================
- Coverage   91.89%   91.89%   -0.01%     
==========================================
  Files          81       81              
  Lines       11626    11629       +3     
==========================================
+ Hits        10684    10686       +2     
- Misses        942      943       +1
Impacted Files Coverage Δ
reframe/frontend/statistics.py 89.71% <0%> (-0.67%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7517577...d546f4c. Read the comment docs.

@vkarak
Copy link
Contributor Author

vkarak commented Jan 28, 2020

Any comments on this, guys?

@teojgo
Copy link
Contributor

teojgo commented Jan 28, 2020

@vkarak I am still looking into it.

Copy link
Contributor

@victorusu victorusu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. I love the new way.
I just did not understand two things, but they are minor and not critical.
The negative side of this syntax is that one cannot comment json.

@vkarak vkarak merged commit 3f5e97f into reframe-hpc:master Feb 5, 2020
@vkarak vkarak deleted the feat/config-json-schema branch February 5, 2020 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Define a new and more flexible configuration syntax

4 participants