-
Notifications
You must be signed in to change notification settings - Fork 20
WIP: Revamp config management #1104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
2d282e4
Bump the minimum required channels version to v1.4.0
llucax b67acd6
Add a `ConfigManager` class
llucax 29725c4
Add an option to wait for the first configuration
llucax 2921ed8
Add option to only send changed configurations
llucax 751d20e
Add support for subscribing to specific config keys
llucax 3ccb4eb
Add support for validating configurations with a schema
llucax e39cd6b
Add support to filter a sub-key
llucax 3129c42
Assert the receiver has the correct type
llucax 63c96a0
Add support for skipping `None` configs
llucax 77295dc
Add a global instance for the config manager
llucax cd08feb
Support using `BackgroundService` as a *mixin*
llucax fbe18de
Add a base config schema that provides quantities support
llucax 3201348
Add a `Reconfigurable` *mixin*
llucax 2878a2a
Make the `LoggingConfigUpdatingActor` `Reconfigurable`
llucax 0b54413
Allow configuring logging via `ConfigManager`
llucax 80fc626
Revert "Make the `LoggingConfigUpdatingActor` `Reconfigurable`"
llucax c34c199
Revert "Add a `Reconfigurable` *mixin*"
llucax 05164ef
Revert "Support using `BackgroundService` as a *mixin*"
llucax dcd76fb
Revert "Add a global instance for the config manager"
llucax 9215c15
WIP: Add full example in the `config` module.
llucax 40dcc3f
Revert "Add an option to wait for the first configuration"
llucax 1f96cec
Improve logging for configuration file reading
llucax 61d4b11
Remove support for receiving raw mapping as configuration
llucax 0cc7e94
Move note about update bursts to Skipping superfluous updates
llucax 4189066
Exclude unknown fields from the config by default
llucax File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # License: MIT | ||
| # Copyright © 2024 Frequenz Energy-as-a-Service GmbH | ||
|
|
||
| """Base schema for configuration classes.""" | ||
|
|
||
| from frequenz.quantities.experimental.marshmallow import QuantitySchema | ||
|
|
||
|
|
||
| class BaseConfigSchema(QuantitySchema): | ||
| """A base schema for configuration classes.""" | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering, why you create BaseConfigSchema?
User can just use QuantitySchema
BaseConfigSchema is not used anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TL;DR: It is mostly to have a more future-proof API.
Maybe it is over-engineering for now, but my thought was that users might want to inherit from
BaseConfigSchemaand add their own custom fields. If in the future we have some other library providing a base schema likeQuantitySchema, we can makeBaseConfigSchemainherit from that too, and the user's code doesn't need to change, it will automatically get the new fields if they are inheriting fromBaseConfigSchema.If we use
QuantitySchema(so users inherit from that), and then we want to ship a base schema with more fields thanQuantitySchema, the users will either need to update their code to now inherit fromBaseConfigSchema, or they won't get the new fields.Yeah, draft PR :-P Fixed in the new version.