Skip to content

Commit df61636

Browse files
authored
Don't stop pools (#1199)
When there are multiple pool instances controlling the same components and one of them stops, that would stop all the pools. This PR adds an emergency fix to prevent this bug, to buy some time to come up with a better solution.
2 parents aee9f44 + 6c31fbc commit df61636

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

RELEASE_NOTES.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414

1515
## Bug Fixes
1616

17-
<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
17+
- Fixes a bug where battery pool metrics would stop for one actor when another actor managing the same components stops its pool.
18+

src/frequenz/sdk/timeseries/battery_pool/_battery_pool.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -399,4 +399,9 @@ def _system_power_bounds(self) -> ReceiverFetcher[SystemBounds]:
399399

400400
async def stop(self) -> None:
401401
"""Stop all tasks and channels owned by the BatteryPool."""
402-
await self._pool_ref_store.stop()
402+
# This was closing the pool_ref_store, which is not correct, because those are
403+
# shared.
404+
#
405+
# This method will do until we have a mechanism to track the resources created
406+
# through it. It can also eventually cleanup the pool_ref_store, when it is
407+
# holding the last reference to it.

src/frequenz/sdk/timeseries/ev_charger_pool/_ev_charger_pool.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,12 @@ def power_distribution_results(self) -> ReceiverFetcher[_power_distributing.Resu
217217

218218
async def stop(self) -> None:
219219
"""Stop all tasks and channels owned by the EVChargerPool."""
220-
await self._pool_ref_store.stop()
220+
# This was closing the pool_ref_store, which is not correct, because those are
221+
# shared.
222+
#
223+
# This method will do until we have a mechanism to track the resources created
224+
# through it. It can also eventually cleanup the pool_ref_store, when it is
225+
# holding the last reference to it.
221226

222227
@property
223228
def _system_power_bounds(self) -> ReceiverFetcher[SystemBounds]:

src/frequenz/sdk/timeseries/pv_pool/_pv_pool.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,12 @@ def power_distribution_results(self) -> ReceiverFetcher[_power_distributing.Resu
179179

180180
async def stop(self) -> None:
181181
"""Stop all tasks and channels owned by the PVPool."""
182-
await self._pool_ref_store.stop()
182+
# This was closing the pool_ref_store, which is not correct, because those are
183+
# shared.
184+
#
185+
# This method will do until we have a mechanism to track the resources created
186+
# through it. It can also eventually cleanup the pool_ref_store, when it is
187+
# holding the last reference to it.
183188

184189
@property
185190
def _system_power_bounds(self) -> ReceiverFetcher[SystemBounds]:

0 commit comments

Comments
 (0)