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 6ce9594..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. @@ -224,11 +227,12 @@ 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, options=dispatch.payload, + _src=dispatch, ) identity = self._dispatch_identity(dispatch)