Skip to content

Commit 797b489

Browse files
authored
Expose src Dispatch for rare complex scenarios (#131)
- **Fix documentation phrasing** - **Add `DispatchInfo._src` for when requiring more context**
2 parents 0333b23 + 67f1b92 commit 797b489

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
## New Features
1212

13-
<!-- Here goes the main new features and examples or instructions on how to use them -->
13+
- `DispatchInfo._src` was added for rare complex scenarios where the source of a dispatch needs to be accessed.
1414

1515
## Bug Fixes
1616

src/frequenz/dispatch/_actor_dispatcher.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ class DispatchInfo:
3232
options: dict[str, Any]
3333
"""Additional options."""
3434

35+
_src: Dispatch
36+
"""The dispatch that triggered this update."""
37+
3538

3639
class ActorDispatcher(BackgroundService):
3740
"""Helper class to manage actors based on dispatches.
@@ -224,11 +227,12 @@ def start(self) -> None:
224227
self._tasks.add(asyncio.create_task(self._run()))
225228

226229
async def _start_actor(self, dispatch: Dispatch) -> None:
227-
"""Start all actors."""
230+
"""Start the actor the given dispatch refers to."""
228231
dispatch_update = DispatchInfo(
229232
components=dispatch.target,
230233
dry_run=dispatch.dry_run,
231234
options=dispatch.payload,
235+
_src=dispatch,
232236
)
233237

234238
identity = self._dispatch_identity(dispatch)

0 commit comments

Comments
 (0)