feat(config)!: Replace contextual CLI arguments with dotted assignments - #923
Merged
Conversation
Verify that CSV input convert missing-file errors into ConnectionFailed exceptions.
Verify that JSON inputs convert missing-file errors into ConnectionFailed exception.
Replace the contextual CLI parser with argparse and the repeatable `-C/--set-config PATH=VALUE` option. Introduce schemas for root properties, component groups and fixed component settings. Load JSON files, environment variables and CLI assignments independencly, merge them with CLI precedence, and validate the resulting configuration once. BREAKING CHANGE: Contextual componenet arguments are replaced by explicit configuration assignments. Schema aliases, ConfigValidator, and legacy parser APIs and exceptions are removed.
Make `Generator` and `DBActorGenerator` generic over their actor and database factory types. Centralize actor, database, report and processor factory resolution. Remove unused registry removal methods, duplicate constants and custom "alread-used" exceptions. Expand behavior-level generator coverage.
BREAKING CHANGE: Modules previously imported from `powerapi.cli` must now be imported from `powerapi.config`.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #923 +/- ##
==========================================
+ Coverage 80.26% 82.91% +2.64%
==========================================
Files 86 86
Lines 3167 2909 -258
==========================================
- Hits 2542 2412 -130
+ Misses 625 497 -128
🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

PR overview:
-C/--set-config PATH=VALUEassignments.powerapi.clipackage topowerapi.config.Example:
python -m powerapi \ -C input.sensor.type=socket \ -C input.sensor.port=9080 \ -C formula.smartwatts.learn-error-window-size=10Existing JSON configuration structure,
POWERAPI_*environment variables, and--config-fileremain supported.Breaking changes
-C/--set-config PATH=VALUE.powerapi.climust usepowerapi.config.kubernetesinstead ofk8s.ConfigValidatorand legacy parser APIs and exceptions are removed.