Skip to content

Commit

Permalink
Merge v1.0.0-rc6xx into v1.x.x
Browse files Browse the repository at this point in the history
* upstream/v1.0.0-rc6xx:
  Update release notes
  Replace `Task.exception()` with `Task.result()`
  Fix gap in ring buffer when updating a missing value
  Clear release notes
  Set zero power for PV inverters not neccessary to reach target power
  Fix PV power distribution

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
  • Loading branch information
llucax committed Aug 21, 2024
2 parents 790f507 + 956823f commit c36a8ea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@
- Fix the handling of canceled tasks in the data sourcing and resampling actor.
- Fix a bug in PV power distribution by excluding inverters that haven't sent any data since startup.
- Prevent stacking of power requests to avoid delays in processing when the power request frequency exceeds the processing time.
- Fixes a bug in the ring buffer in case the updated value is missing and creates a gap in time.
5 changes: 4 additions & 1 deletion src/frequenz/sdk/timeseries/_ringbuffer/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,11 @@ def _update_gaps(
# New missing entry that is not already in a gap?
if record_as_missing:
if not found_in_gaps:
# If there are no gaps and the new value is not subsequent to the
# newest value, we need to start the new gap after the newest value
start_gap = min(newest + self._sampling_period, timestamp)
self._gaps.append(
Gap(start=timestamp, end=timestamp + self._sampling_period)
Gap(start=start_gap, end=timestamp + self._sampling_period)
)
elif len(self._gaps) > 0:
if found_in_gaps:
Expand Down
10 changes: 5 additions & 5 deletions tests/timeseries/test_ringbuffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ def test_gaps() -> None: # pylint: disable=too-many-statements
assert buffer.count_covered() == 5
assert len(buffer.gaps) == 0

# whole range gap suffers from sdk#646
# whole range gap
buffer.update(Sample(dt(99), None))
assert buffer.oldest_timestamp == dt(95) # bug: should be None
assert buffer.newest_timestamp == dt(99) # bug: should be None
assert buffer.count_valid() == 4 # bug: should be 0 (whole range gap)
assert buffer.count_covered() == 5 # bug: should be 0
assert buffer.oldest_timestamp is None
assert buffer.newest_timestamp is None
assert buffer.count_valid() == 0
assert buffer.count_covered() == 0
assert len(buffer.gaps) == 1


Expand Down

0 comments on commit c36a8ea

Please sign in to comment.