frequenz-dispatch 0.7.0__tar.gz → 0.8.0__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.7.0 → frequenz_dispatch-0.8.0}/PKG-INFO +2 -2
- frequenz_dispatch-0.8.0/RELEASE_NOTES.md +8 -0
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/pyproject.toml +1 -1
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz/dispatch/_actor_dispatcher.py +21 -4
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz/dispatch/_bg_service.py +3 -3
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz_dispatch.egg-info/PKG-INFO +2 -2
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz_dispatch.egg-info/requires.txt +1 -1
- frequenz_dispatch-0.7.0/RELEASE_NOTES.md +0 -9
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/LICENSE +0 -0
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/MANIFEST.in +0 -0
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/README.md +0 -0
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/setup.cfg +0 -0
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz/dispatch/__init__.py +0 -0
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz/dispatch/_dispatch.py +0 -0
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz/dispatch/_dispatcher.py +0 -0
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz/dispatch/_event.py +0 -0
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz/dispatch/_merge_strategies.py +0 -0
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz/dispatch/conftest.py +0 -0
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz/dispatch/py.typed +0 -0
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz_dispatch.egg-info/SOURCES.txt +0 -0
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz_dispatch.egg-info/dependency_links.txt +0 -0
- {frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/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.
|
|
3
|
+
Version: 0.8.0
|
|
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-rc2100,>=1.0.0-rc2000
|
|
25
25
|
Requires-Dist: frequenz-channels<2.0.0,>=1.6.1
|
|
26
26
|
Requires-Dist: frequenz-client-dispatch<0.11.0,>=0.10.1
|
|
27
27
|
Provides-Extra: dev-flake8
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Dispatch Highlevel Interface Release Notes
|
|
2
|
+
|
|
3
|
+
## New Features
|
|
4
|
+
|
|
5
|
+
* This release now supports the sdk up to rc2000.
|
|
6
|
+
* Less logs are now on `INFO` level, and more on `DEBUG` level, making the output less verbose.
|
|
7
|
+
* Changed the type of `DispatchInfo.components` from `list[int] | list[ComponentCategory]` to `list[ComponentId] | list[ComponentCategory]`, where `ComponentId` is imported from `frequenz.client.microgrid`.
|
|
8
|
+
|
|
@@ -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-
|
|
41
|
+
"frequenz-sdk >= 1.0.0-rc2000, < 1.0.0-rc2100",
|
|
42
42
|
"frequenz-channels >= 1.6.1, < 2.0.0",
|
|
43
43
|
"frequenz-client-dispatch >= 0.10.1, < 0.11.0",
|
|
44
44
|
]
|
{frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz/dispatch/_actor_dispatcher.py
RENAMED
|
@@ -8,16 +8,23 @@ import logging
|
|
|
8
8
|
from collections.abc import Callable
|
|
9
9
|
from dataclasses import dataclass
|
|
10
10
|
from datetime import timedelta
|
|
11
|
-
from typing import Any, Awaitable
|
|
11
|
+
from typing import Any, Awaitable, cast
|
|
12
12
|
|
|
13
13
|
from frequenz.channels import Broadcast, Receiver, Sender, select
|
|
14
|
-
from frequenz.client.
|
|
14
|
+
from frequenz.client.common.microgrid.components import ComponentCategory
|
|
15
|
+
from frequenz.client.microgrid import ComponentId
|
|
15
16
|
from frequenz.sdk.actor import Actor, BackgroundService
|
|
16
17
|
|
|
17
18
|
from ._dispatch import Dispatch
|
|
18
19
|
|
|
19
20
|
_logger = logging.getLogger(__name__)
|
|
20
21
|
|
|
22
|
+
TargetComponents = list[ComponentId] | list[ComponentCategory]
|
|
23
|
+
"""One or more target components specifying which components a dispatch targets.
|
|
24
|
+
|
|
25
|
+
It can be a list of component IDs or a list of categories.
|
|
26
|
+
"""
|
|
27
|
+
|
|
21
28
|
|
|
22
29
|
@dataclass(frozen=True, kw_only=True)
|
|
23
30
|
class DispatchInfo:
|
|
@@ -46,7 +53,6 @@ class ActorDispatcher(BackgroundService):
|
|
|
46
53
|
import asyncio
|
|
47
54
|
from typing import override
|
|
48
55
|
from frequenz.dispatch import Dispatcher, ActorDispatcher, DispatchInfo
|
|
49
|
-
from frequenz.client.dispatch.types import TargetComponents
|
|
50
56
|
from frequenz.client.common.microgrid.components import ComponentCategory
|
|
51
57
|
from frequenz.channels import Receiver, Broadcast, select, selected_from
|
|
52
58
|
from frequenz.sdk.actor import Actor, run
|
|
@@ -236,10 +242,21 @@ class ActorDispatcher(BackgroundService):
|
|
|
236
242
|
"""Start the background service."""
|
|
237
243
|
self._tasks.add(asyncio.create_task(self._run()))
|
|
238
244
|
|
|
245
|
+
def _get_target_components_from_dispatch(
|
|
246
|
+
self, dispatch: Dispatch
|
|
247
|
+
) -> TargetComponents:
|
|
248
|
+
if all(isinstance(comp, int) for comp in dispatch.target):
|
|
249
|
+
# We've confirmed all elements are integers, so we can cast.
|
|
250
|
+
int_components = cast(list[int], dispatch.target)
|
|
251
|
+
return [ComponentId(cid) for cid in int_components]
|
|
252
|
+
# If not all are ints, then it must be a list of ComponentCategory
|
|
253
|
+
# based on the definition of ClientTargetComponents.
|
|
254
|
+
return cast(list[ComponentCategory], dispatch.target)
|
|
255
|
+
|
|
239
256
|
async def _start_actor(self, dispatch: Dispatch) -> None:
|
|
240
257
|
"""Start the actor the given dispatch refers to."""
|
|
241
258
|
dispatch_update = DispatchInfo(
|
|
242
|
-
components=dispatch
|
|
259
|
+
components=self._get_target_components_from_dispatch(dispatch),
|
|
243
260
|
dry_run=dispatch.dry_run,
|
|
244
261
|
options=dispatch.payload,
|
|
245
262
|
_src=dispatch,
|
|
@@ -296,7 +296,7 @@ class DispatchScheduler(BackgroundService):
|
|
|
296
296
|
self._dispatches = {}
|
|
297
297
|
|
|
298
298
|
try:
|
|
299
|
-
_logger.
|
|
299
|
+
_logger.debug("Fetching dispatches for microgrid %s", self._microgrid_id)
|
|
300
300
|
async for page in self._client.list(microgrid_id=self._microgrid_id):
|
|
301
301
|
for client_dispatch in page:
|
|
302
302
|
dispatch = Dispatch(client_dispatch)
|
|
@@ -314,7 +314,7 @@ class DispatchScheduler(BackgroundService):
|
|
|
314
314
|
)
|
|
315
315
|
await self._lifecycle_events_tx.send(Updated(dispatch=dispatch))
|
|
316
316
|
|
|
317
|
-
_logger.
|
|
317
|
+
_logger.debug("Received %s dispatches", len(self._dispatches))
|
|
318
318
|
|
|
319
319
|
except grpc.aio.AioRpcError as error:
|
|
320
320
|
_logger.error("Error fetching dispatches: %s", error)
|
|
@@ -322,7 +322,7 @@ class DispatchScheduler(BackgroundService):
|
|
|
322
322
|
return
|
|
323
323
|
|
|
324
324
|
for dispatch in old_dispatches.values():
|
|
325
|
-
_logger.
|
|
325
|
+
_logger.debug("Deleted dispatch: %s", dispatch)
|
|
326
326
|
await self._lifecycle_events_tx.send(Deleted(dispatch=dispatch))
|
|
327
327
|
await self._update_dispatch_schedule_and_notify(None, dispatch)
|
|
328
328
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: frequenz-dispatch
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
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-rc2100,>=1.0.0-rc2000
|
|
25
25
|
Requires-Dist: frequenz-channels<2.0.0,>=1.6.1
|
|
26
26
|
Requires-Dist: frequenz-client-dispatch<0.11.0,>=0.10.1
|
|
27
27
|
Provides-Extra: dev-flake8
|
|
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.7.0 → frequenz_dispatch-0.8.0}/src/frequenz/dispatch/_merge_strategies.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz_dispatch.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{frequenz_dispatch-0.7.0 → frequenz_dispatch-0.8.0}/src/frequenz_dispatch.egg-info/top_level.txt
RENAMED
|
File without changes
|