Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
- Improved formula validation: Consistent error messages for invalid formulas and conventional span semantics.

- This fixes a rare power distributor bug where some battery inverters becoming unreachable because of network outages would lead to excess power values getting set. This is fixed by measuring the power of the unreachable inverters through their fallback meters and excluding that power from what is distributed to the other inverters.

- Fixed stopping formulas: It will now also stop the evaluator and sub-formulas correctly.
18 changes: 13 additions & 5 deletions src/frequenz/sdk/timeseries/formulas/_formula.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,20 @@ def start(self) -> None:
self._evaluator.start()

@override
async def stop(self, msg: str | None = None) -> None:
"""Stop the formula evaluator."""
await BackgroundService.stop(self, msg)
def cancel(self, msg: str | None = None) -> None:
"""Cancel the formula evaluator."""
super().cancel(msg)
for sub_formula in self._sub_formulas:
await sub_formula.stop(msg)
await self._evaluator.stop(msg)
sub_formula.cancel(msg)
self._evaluator.cancel(msg)

@override
async def wait(self) -> None:
"""Wait for the formula evaluator to finish."""
await super().wait()
for sub_formula in self._sub_formulas:
await sub_formula.wait()
await self._evaluator.wait()

def __add__(
self, other: FormulaBuilder[QuantityT] | QuantityT | Formula[QuantityT]
Expand Down
Loading