From 7ee770f9e8d7d5b3f3a2a3a7107247373379aa21 Mon Sep 17 00:00:00 2001 From: "Mathias L. Baumann" Date: Tue, 1 Apr 2025 17:11:12 +0200 Subject: [PATCH 1/2] Fix documentation phrasing Signed-off-by: Mathias L. Baumann --- src/frequenz/dispatch/_actor_dispatcher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frequenz/dispatch/_actor_dispatcher.py b/src/frequenz/dispatch/_actor_dispatcher.py index 6ce9594..9ad2349 100644 --- a/src/frequenz/dispatch/_actor_dispatcher.py +++ b/src/frequenz/dispatch/_actor_dispatcher.py @@ -224,7 +224,7 @@ def start(self) -> None: self._tasks.add(asyncio.create_task(self._run())) async def _start_actor(self, dispatch: Dispatch) -> None: - """Start all actors.""" + """Start the actor the given dispatch refers to.""" dispatch_update = DispatchInfo( components=dispatch.target, dry_run=dispatch.dry_run, From 67f1b92ebd0a424629c8ae5de27a425b8e97340f Mon Sep 17 00:00:00 2001 From: "Mathias L. Baumann" Date: Tue, 1 Apr 2025 17:04:56 +0200 Subject: [PATCH 2/2] Add `DispatchInfo._src` for when requiring more context Signed-off-by: Mathias L. Baumann --- RELEASE_NOTES.md | 2 +- src/frequenz/dispatch/_actor_dispatcher.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 3c29f0f..b8dd657 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -10,7 +10,7 @@ ## New Features - +- `DispatchInfo._src` was added for rare complex scenarios where the source of a dispatch needs to be accessed. ## Bug Fixes diff --git a/src/frequenz/dispatch/_actor_dispatcher.py b/src/frequenz/dispatch/_actor_dispatcher.py index 9ad2349..e97a434 100644 --- a/src/frequenz/dispatch/_actor_dispatcher.py +++ b/src/frequenz/dispatch/_actor_dispatcher.py @@ -32,6 +32,9 @@ class DispatchInfo: options: dict[str, Any] """Additional options.""" + _src: Dispatch + """The dispatch that triggered this update.""" + class ActorDispatcher(BackgroundService): """Helper class to manage actors based on dispatches. @@ -229,6 +232,7 @@ async def _start_actor(self, dispatch: Dispatch) -> None: components=dispatch.target, dry_run=dispatch.dry_run, options=dispatch.payload, + _src=dispatch, ) identity = self._dispatch_identity(dispatch)