Tags: shsms/frequenz-sdk-python
Tags
# Frequenz Python SDK Release Notes
## Summary
This release introduces a number of breaking changes in the config manager, the new `ComponentId`/`MicrogridId` types and the `numpy` version update. It also includes bug-fixes to the component graph and power management.
## Upgrading
* Includes a major update of the numpy dependency to v2.x.
* The logging configuration was changed, and now the logger name needs to be specified explicitly (the configuration key was used as the name before). This is to be compatible with configuration generated by the UI, which doesn't quote sub-key properly.
- Before:
```toml
[logging.loggers."frequenz.sdk.config"]
level = "DEBUG"
```
- Now:
```toml
[logging.loggers.frequenz_config]
name = "frequenz.sdk.config"
level = "DEBUG"
```
* The logging configuration now uses a separate class for the root logger configuration: `RootLoggerConfig`.
- Before:
```py
LoggingConfig(root_logger=LoggerConfig(level="ERROR"))
```
- Now:
```py
LoggingConfig(root_logger=RootLoggerConfig(level="ERROR"))
```
* The SDK now depends on the `frequenz-client-microgrid` v0.7.x series. The main change is now all component and microgrid IDs need to be passed using the wrapper classes `ComponentId`/`MicrogridId` instead of `int`.
## Bug Fixes
- The power manager used to just forgot components when all proposals to them are withdrawn, leaving them at their last set power values. This has been fixed by getting the power manager to set the components to their default powers, based on the component category (according to the table below), as the last step.
| component category | default power |
|--------------------|-------------------------------------------|
| Battery | 0.0 |
| PV | Minimum power (aka max production power) |
| EV Chargers | Maximum power (aka max consumption power) |
- PV Pool instances can now be created in sites without any PV. This allows for writing generic code that works for all locations, that depends on the PV power formula, for example.
- `Success/PartialFailure` results from `PVPool.power_distribution_results` now report correct `succeeded_power` values.
- The `find_first_descendant_component` method in the component graph was allowing non-root components to be used as the root component during traversal. This was leading to confusing behaviour when the root component couldn't be identified deterministically. For example, if the root category was specified as a meter, it could start traversing from a different meter each time. It is no-longer possible to specify a root category anymore and it always traverses from the `GRID` component.
# Frequenz Python SDK Release Notes ## Bug Fixes - The additive `ShiftingMatryoshka` algorithm was made for batteries, but got set as the default algorithm for PV and EV chargers. This is now reversed and PV and EV chargers are back to using the original `Matryoshka` algorithm.
# Frequenz Python SDK Release Notes ## Bug Fixes - Fixes a bug where battery pool metrics would stop for one actor when another actor managing the same components stops its pool.
# Frequenz Python SDK Release Notes ## Upgrading - The `microgrid.new_*_pool` methods no longer accept a `set_operating_point` parameter. - The power manager now uses a new algorithm described [here](https://frequenz-floss.github.io/frequenz-sdk-python/v1.0-dev/user-guide/microgrid-concepts/#frequenz.sdk.microgrid--setting-power). ## Bug Fixes - Fix `MetricFetcher` leaks when a requested metric fetcher already existed.
# Frequenz Python SDK Release Notes ## Summary ## New Features - Add a `stop()` method to the `FormulaEngine`. Now it is possible to stop custom formulas. - Stop fallback formulas when primary formula starts working again. ## Bug Fixes - Fixed a bug with formulas raising exception when stopped. - Fixed a bug that raised `CancelledError` when actor was started with `frequenz.sdk.actor.run` and stopped. - Stop catching `BaseException` in `frequenz.sdk.actor.run`. Only `CancelledError` and `Exception` are caught now.
# Frequenz Python SDK Release Notes ## New Features - The `MovingWindow` now has an async `wait_for_samples` method that waits for a given number of samples to become available in the moving window and then returns. ## Bug Fixes - Fixed a bug that was preventing power proposals to go through if there once existed some proposals with overlapping component IDs, even if the old proposals have expired. - Fixed a bug that was causing formulas to fallback to CHPs, when the CHP meters didn't have data. CHPs are not supported in the data sourcing actor and in the client, so we can't fallback to CHPs.
# Frequenz Python SDK Release Notes
## Summary
This release includes a new `ConfigManager` class to simplify managing the configuration, and ships other improvements and fixes to the config system in general.
## Upgrading
- `frequenz.sdk.config`
* `LoggingConfigUpdater`
+ Renamed to `LoggingConfigUpdatingActor` to follow the actor naming convention.
+ The actor must now be constructed using a `ConfigManager` instead of a receiver.
+ Make all arguments to the constructor keyword-only, except for the `config_manager` argument.
+ If the configuration is removed, the actor will now load back the default configuration.
* `LoggingConfig`
+ The `load()` method was removed. Please use `frequenz.sdk.config.load_config()` instead.
+ The class is now a standard `dataclass` instead of a `marshmallow_dataclass`.
+ The class is now immutable.
+ The constructor now accepts only keyword arguments.
* `LoggerConfig`
+ The class is now a standard `dataclass` instead of a `marshmallow_dataclass`.
+ The class is now immutable.
+ The constructor now accepts only keyword arguments.
* `load_config()`:
+ The `base_schema` argument is now keyword-only and defaults to `BaseConfigSchema` (and because of this, it uses `unknown=EXCLUDE` by default).
+ The arguments forwarded to `marshmallow.Schema.load()` now must be passed explicitly via the `marshmallow_load_kwargs` argument, as a `dict`, to improve the type-checking.
+ Will now raise a `ValueError` if `unknown` is set to `INCLUDE` in `marshmallow_load_kwargs`.
* `ConfigManagingActor`: Raise a `ValueError` if the `config_files` argument an empty sequence.
## New Features
- `frequenz.sdk.config`
- Logging was improved in general.
- Added documentation and user guide.
- `LoggingConfigUpdatingActor`
* Added a new `name` argument to the constructor to be able to override the actor's name.
- `ConfigManager`: Added a class to simplify managing the configuration. It takes care of instantiating the config actors and provides a convenient method for creating receivers with a lot of common functionality.
- `BaseConfigSchema`: Added a `marshmallow` base `Schema` that includes custom fields for `frequenz-quantities`. In the futute more commonly used fields might be added.
- `wait_for_first()`: Added a function to make it easy to wait for the first configuration to be received with a timeout.
- `ConfigManagingActor`: Allow passing a single configuration file.
## Bug Fixes
- Fix a bug in `BackgroundService` where it won't try to `self.cancel()` and `await self.wait()` if there are no internal tasks. This prevented to properly implement custom stop logic without having to redefine the `stop()` method too.
- Fix a bug where if a string was passed to the `ConfigManagingActor` it would be interpreted as a sequence of 1 character strings.
- Remove a confusing log message in the power distributing actor.
- Close all receivers owned by a *pool when stopping the pool.
# Frequenz Python SDK Release Notes ## Summary This is a minor release with just a few bug fixes but also one breaking change in the `ConfigManagingActor`. ## Upgrading - The `ConfigManagingActor` now only reacts to `CREATE` and `MODIFY` events. `DELETE` is not supported anymore and are ignored. - Remove the `event_types` argument from the `ConfigManagingActor` constructor. ## Bug Fixes - Fix bugs with `ConfigManagingActor`: - Raising unhandled exceptions when any file in config directory was deleted. - Raising unhandled exception if not all config files exist. - Eliminate recursive actor crashes when all config files were missing.
# Frequenz Python SDK Release Notes ## Improvements * Many tasks, senders and receivers now have proper names for easier debugging. * The resample log was improved to show more details. * The `Sample` class now has a nice `__str__` representation. ## Bug Fixes - Fix a bug in the resampler that could end up with an *IndexError: list index out of range* exception when a new resampler was added while awaiting the existing resampler to finish resampling.
# Frequenz Python SDK Release Notes ## Bug Fixes * Fix bug with `LoggingConfigUpdater` not updating root logger level. * The `frequenz-quantities` dependency requirement was widened to allow any v1.x version (it was pinned to `1.0.0rc3` before).
PreviousNext