Skip to content

Commit db533d1

Browse files
committed
Rename DispatchManagingActor to ActorDispatcher
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 3df0245 commit db533d1

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/frequenz/dispatch/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
88
* [Dispatcher][frequenz.dispatch.Dispatcher]: The entry point for the API.
99
* [Dispatch][frequenz.dispatch.Dispatch]: A dispatch type with lots of useful extra functionality.
10-
* [DispatchManagingActor][frequenz.dispatch.DispatchManagingActor]: An actor to
11-
manage other actors based on incoming dispatches.
10+
* [ActorDispatcher][frequenz.dispatch.ActorDispatcher]: A service to manage other actors based on
11+
incoming dispatches.
1212
* [Created][frequenz.dispatch.Created],
1313
[Updated][frequenz.dispatch.Updated],
1414
[Deleted][frequenz.dispatch.Deleted]: Dispatch event types.
1515
1616
"""
1717

18+
from ._actor_dispatcher import ActorDispatcher, DispatchUpdate
1819
from ._dispatch import Dispatch
1920
from ._dispatcher import Dispatcher
2021
from ._event import Created, Deleted, DispatchEvent, Updated
21-
from ._managing_actor import DispatchManagingActor, DispatchUpdate
2222

2323
__all__ = [
2424
"Created",
@@ -27,6 +27,6 @@
2727
"Dispatcher",
2828
"Updated",
2929
"Dispatch",
30-
"DispatchManagingActor",
30+
"ActorDispatcher",
3131
"DispatchUpdate",
3232
]

src/frequenz/dispatch/_managing_actor.py renamed to src/frequenz/dispatch/_actor_dispatcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class DispatchUpdate:
3232
"""Additional options."""
3333

3434

35-
class DispatchManagingActor(BackgroundService):
35+
class ActorDispatcher(BackgroundService):
3636
"""Helper class to manage actors based on dispatches.
3737
3838
Example usage:

tests/test_mananging_actor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from frequenz.sdk.actor import Actor
1919
from pytest import fixture
2020

21-
from frequenz.dispatch import Dispatch, DispatchManagingActor, DispatchUpdate
21+
from frequenz.dispatch import ActorDispatcher, Dispatch, DispatchUpdate
2222
from frequenz.dispatch._bg_service import DispatchScheduler
2323

2424

@@ -65,7 +65,7 @@ async def _run(self) -> None:
6565
class TestEnv:
6666
"""Test environment."""
6767

68-
actors_service: DispatchManagingActor
68+
actors_service: ActorDispatcher
6969
running_status_sender: Sender[Dispatch]
7070
generator: DispatchGenerator = DispatchGenerator()
7171

@@ -90,7 +90,7 @@ async def test_env() -> AsyncIterator[TestEnv]:
9090
"""Create a test environment."""
9191
channel = Broadcast[Dispatch](name="dispatch ready test channel")
9292

93-
actors_service = DispatchManagingActor(
93+
actors_service = ActorDispatcher(
9494
actor_factory=MockActor,
9595
running_status_receiver=channel.new_receiver(),
9696
)
@@ -149,7 +149,7 @@ async def test_simple_start_stop(
149149
fake_time.shift(duration)
150150
await test_env.running_status_sender.send(Dispatch(dispatch))
151151

152-
# Give await actor.stop a chance to run in DispatchManagingActor
152+
# Give await actor.stop a chance to run
153153
await asyncio.sleep(1)
154154

155155
assert test_env.actor is None
@@ -237,7 +237,7 @@ async def test_dry_run(test_env: TestEnv, fake_time: time_machine.Coordinates) -
237237
fake_time.shift(dispatch.duration)
238238
await test_env.running_status_sender.send(Dispatch(dispatch))
239239

240-
# Give await actor.stop a chance to run in DispatchManagingActor
240+
# Give await actor.stop a chance to run
241241
await asyncio.sleep(1)
242242

243243
assert test_env.actor is None

0 commit comments

Comments
 (0)