frequenz-dispatch 0.6.1__tar.gz → 0.6.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/PKG-INFO +2 -2
- frequenz_dispatch-0.6.2/RELEASE_NOTES.md +18 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/pyproject.toml +1 -1
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz/dispatch/_actor_dispatcher.py +32 -18
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz_dispatch.egg-info/PKG-INFO +2 -2
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz_dispatch.egg-info/requires.txt +1 -1
- frequenz_dispatch-0.6.1/RELEASE_NOTES.md +0 -9
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/LICENSE +0 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/MANIFEST.in +0 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/README.md +0 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/setup.cfg +0 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz/dispatch/__init__.py +0 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz/dispatch/_bg_service.py +0 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz/dispatch/_dispatch.py +0 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz/dispatch/_dispatcher.py +0 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz/dispatch/_event.py +0 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz/dispatch/_merge_strategies.py +0 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz/dispatch/conftest.py +0 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz/dispatch/py.typed +0 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz_dispatch.egg-info/SOURCES.txt +0 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz_dispatch.egg-info/dependency_links.txt +0 -0
- {frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz_dispatch.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: frequenz-dispatch
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: A highlevel interface for the dispatch API
|
|
5
5
|
Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
|
|
6
6
|
License: MIT
|
|
@@ -21,7 +21,7 @@ Requires-Python: <4,>=3.11
|
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
23
|
Requires-Dist: typing-extensions<5.0.0,>=4.13.0
|
|
24
|
-
Requires-Dist: frequenz-sdk<1.0.0-
|
|
24
|
+
Requires-Dist: frequenz-sdk<1.0.0-rc1900,>=1.0.0-rc1302
|
|
25
25
|
Requires-Dist: frequenz-channels<2.0.0,>=1.6.1
|
|
26
26
|
Requires-Dist: frequenz-client-dispatch<0.9.0,>=0.8.4
|
|
27
27
|
Provides-Extra: dev-flake8
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Dispatch Highlevel Interface Release Notes
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
<!-- Here goes a general summary of what this release is about -->
|
|
6
|
+
|
|
7
|
+
## Upgrading
|
|
8
|
+
|
|
9
|
+
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
|
|
10
|
+
|
|
11
|
+
## New Features
|
|
12
|
+
|
|
13
|
+
<!-- Here goes the main new features and examples or instructions on how to use them -->
|
|
14
|
+
|
|
15
|
+
## Bug Fixes
|
|
16
|
+
|
|
17
|
+
* ActorDispatcher: Fix that every actor instance wrongly received all updates for their dispatch type. This is only relevant to you if your actor has more than one running instance at any time.
|
|
18
|
+
|
|
@@ -38,7 +38,7 @@ dependencies = [
|
|
|
38
38
|
# Make sure to update the version for cross-referencing also in the
|
|
39
39
|
# mkdocs.yml file when changing the version here (look for the config key
|
|
40
40
|
# plugins.mkdocstrings.handlers.python.import)
|
|
41
|
-
"frequenz-sdk >= 1.0.0-rc1302, < 1.0.0-
|
|
41
|
+
"frequenz-sdk >= 1.0.0-rc1302, < 1.0.0-rc1900",
|
|
42
42
|
"frequenz-channels >= 1.6.1, < 2.0.0",
|
|
43
43
|
"frequenz-client-dispatch >= 0.8.4, < 0.9.0",
|
|
44
44
|
]
|
{frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz/dispatch/_actor_dispatcher.py
RENAMED
|
@@ -10,7 +10,7 @@ from dataclasses import dataclass
|
|
|
10
10
|
from datetime import timedelta
|
|
11
11
|
from typing import Any, Awaitable
|
|
12
12
|
|
|
13
|
-
from frequenz.channels import Broadcast, Receiver, select
|
|
13
|
+
from frequenz.channels import Broadcast, Receiver, Sender, select
|
|
14
14
|
from frequenz.client.dispatch.types import TargetComponents
|
|
15
15
|
from frequenz.sdk.actor import Actor, BackgroundService
|
|
16
16
|
|
|
@@ -189,6 +189,19 @@ class ActorDispatcher(BackgroundService):
|
|
|
189
189
|
_logger.info("Retrying dispatch %s now", dispatch.id)
|
|
190
190
|
await self._sender.send(dispatch)
|
|
191
191
|
|
|
192
|
+
@dataclass(frozen=True, kw_only=True)
|
|
193
|
+
class ActorAndChannel:
|
|
194
|
+
"""Actor and its sender."""
|
|
195
|
+
|
|
196
|
+
actor: Actor
|
|
197
|
+
"""The actor."""
|
|
198
|
+
|
|
199
|
+
channel: Broadcast[DispatchInfo]
|
|
200
|
+
"""The channel for dispatch updates."""
|
|
201
|
+
|
|
202
|
+
sender: Sender[DispatchInfo]
|
|
203
|
+
"""The sender for dispatch updates."""
|
|
204
|
+
|
|
192
205
|
def __init__( # pylint: disable=too-many-arguments, too-many-positional-arguments
|
|
193
206
|
self,
|
|
194
207
|
actor_factory: Callable[
|
|
@@ -215,11 +228,8 @@ class ActorDispatcher(BackgroundService):
|
|
|
215
228
|
|
|
216
229
|
self._dispatch_rx = running_status_receiver
|
|
217
230
|
self._actor_factory = actor_factory
|
|
218
|
-
self._actors: dict[int,
|
|
219
|
-
|
|
220
|
-
name="dispatch_updates_channel", resend_latest=True
|
|
221
|
-
)
|
|
222
|
-
self._updates_sender = self._updates_channel.new_sender()
|
|
231
|
+
self._actors: dict[int, ActorDispatcher.ActorAndChannel] = {}
|
|
232
|
+
|
|
223
233
|
self._retrier = ActorDispatcher.FailedDispatchesRetrier(retry_interval)
|
|
224
234
|
|
|
225
235
|
def start(self) -> None:
|
|
@@ -236,24 +246,25 @@ class ActorDispatcher(BackgroundService):
|
|
|
236
246
|
)
|
|
237
247
|
|
|
238
248
|
identity = self._dispatch_identity(dispatch)
|
|
239
|
-
|
|
249
|
+
actor_and_channel = self._actors.get(identity)
|
|
240
250
|
|
|
241
|
-
if
|
|
242
|
-
|
|
243
|
-
if self._updates_sender is not None:
|
|
244
|
-
sent_str = ", sent a dispatch update instead of creating a new actor"
|
|
245
|
-
await self._updates_sender.send(dispatch_update)
|
|
251
|
+
if actor_and_channel:
|
|
252
|
+
await actor_and_channel.sender.send(dispatch_update)
|
|
246
253
|
_logger.info(
|
|
247
|
-
"Actor for dispatch type %r is already running
|
|
254
|
+
"Actor for dispatch type %r is already running, "
|
|
255
|
+
"sent a dispatch update instead of creating a new actor",
|
|
248
256
|
dispatch.type,
|
|
249
|
-
sent_str,
|
|
250
257
|
)
|
|
251
258
|
else:
|
|
252
259
|
try:
|
|
253
260
|
_logger.info("Starting actor for dispatch type %r", dispatch.type)
|
|
261
|
+
channel = Broadcast[DispatchInfo](
|
|
262
|
+
name=f"dispatch_updates_channel_instance={identity}",
|
|
263
|
+
resend_latest=True,
|
|
264
|
+
)
|
|
254
265
|
actor = await self._actor_factory(
|
|
255
266
|
dispatch_update,
|
|
256
|
-
|
|
267
|
+
channel.new_receiver(limit=1, warn_on_overflow=False),
|
|
257
268
|
)
|
|
258
269
|
|
|
259
270
|
actor.start()
|
|
@@ -267,7 +278,9 @@ class ActorDispatcher(BackgroundService):
|
|
|
267
278
|
self._retrier.retry(dispatch)
|
|
268
279
|
else:
|
|
269
280
|
# No exception occurred, so we can add the actor to the list
|
|
270
|
-
self._actors[identity] =
|
|
281
|
+
self._actors[identity] = ActorDispatcher.ActorAndChannel(
|
|
282
|
+
actor=actor, channel=channel, sender=channel.new_sender()
|
|
283
|
+
)
|
|
271
284
|
|
|
272
285
|
async def _stop_actor(self, stopping_dispatch: Dispatch, msg: str) -> None:
|
|
273
286
|
"""Stop all actors.
|
|
@@ -278,8 +291,9 @@ class ActorDispatcher(BackgroundService):
|
|
|
278
291
|
"""
|
|
279
292
|
identity = self._dispatch_identity(stopping_dispatch)
|
|
280
293
|
|
|
281
|
-
if
|
|
282
|
-
await actor.stop(msg)
|
|
294
|
+
if actor_and_channel := self._actors.pop(identity, None):
|
|
295
|
+
await actor_and_channel.actor.stop(msg)
|
|
296
|
+
await actor_and_channel.channel.close()
|
|
283
297
|
else:
|
|
284
298
|
_logger.warning(
|
|
285
299
|
"Actor for dispatch type %r is not running", stopping_dispatch.type
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: frequenz-dispatch
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: A highlevel interface for the dispatch API
|
|
5
5
|
Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
|
|
6
6
|
License: MIT
|
|
@@ -21,7 +21,7 @@ Requires-Python: <4,>=3.11
|
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
23
|
Requires-Dist: typing-extensions<5.0.0,>=4.13.0
|
|
24
|
-
Requires-Dist: frequenz-sdk<1.0.0-
|
|
24
|
+
Requires-Dist: frequenz-sdk<1.0.0-rc1900,>=1.0.0-rc1302
|
|
25
25
|
Requires-Dist: frequenz-channels<2.0.0,>=1.6.1
|
|
26
26
|
Requires-Dist: frequenz-client-dispatch<0.9.0,>=0.8.4
|
|
27
27
|
Provides-Extra: dev-flake8
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# Dispatch Highlevel Interface Release Notes
|
|
2
|
-
|
|
3
|
-
## Upgrading
|
|
4
|
-
|
|
5
|
-
- Some minimal dependencies were updated, you might need to adjust your project's dependencies too.
|
|
6
|
-
|
|
7
|
-
## New Features
|
|
8
|
-
|
|
9
|
-
- `DispatchInfo._src` was added for rare complex scenarios where the source of a dispatch needs to be accessed.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz/dispatch/_merge_strategies.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz_dispatch.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{frequenz_dispatch-0.6.1 → frequenz_dispatch-0.6.2}/src/frequenz_dispatch.egg-info/top_level.txt
RENAMED
|
File without changes
|