frequenz-dispatch 0.1.0__tar.gz → 0.3.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.1.0/src/frequenz_dispatch.egg-info → frequenz-dispatch-0.3.0}/PKG-INFO +10 -7
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/README.md +9 -6
- frequenz-dispatch-0.3.0/RELEASE_NOTES.md +20 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/pyproject.toml +38 -29
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/src/frequenz/dispatch/_dispatcher.py +40 -27
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/src/frequenz/dispatch/actor.py +21 -22
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0/src/frequenz_dispatch.egg-info}/PKG-INFO +10 -7
- frequenz-dispatch-0.3.0/src/frequenz_dispatch.egg-info/requires.txt +55 -0
- frequenz-dispatch-0.1.0/RELEASE_NOTES.md +0 -14
- frequenz-dispatch-0.1.0/src/frequenz_dispatch.egg-info/requires.txt +0 -56
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/LICENSE +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/MANIFEST.in +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/setup.cfg +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/src/frequenz/dispatch/__init__.py +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/src/frequenz/dispatch/_dispatch.py +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/src/frequenz/dispatch/_event.py +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/src/frequenz/dispatch/conftest.py +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/src/frequenz/dispatch/py.typed +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/src/frequenz_dispatch.egg-info/SOURCES.txt +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/src/frequenz_dispatch.egg-info/dependency_links.txt +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/src/frequenz_dispatch.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: frequenz-dispatch
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.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
|
|
@@ -52,17 +52,20 @@ The [`Dispatcher` class](https://frequenz-floss.github.io/frequenz-dispatch-pyth
|
|
|
52
52
|
|
|
53
53
|
```python
|
|
54
54
|
import os
|
|
55
|
-
import
|
|
55
|
+
from frequenz.dispatch import Dispatcher, RunningState
|
|
56
56
|
from unittest.mock import MagicMock
|
|
57
57
|
|
|
58
58
|
async def run():
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
url = os.getenv("DISPATCH_API_URL", "grpc://fz-0004.frequenz.io:50051")
|
|
60
|
+
key = os.getenv("DISPATCH_API_KEY", "some-key")
|
|
61
61
|
|
|
62
|
-
service_address = f"{host}:{port}"
|
|
63
|
-
grpc_channel = grpc.aio.insecure_channel(service_address)
|
|
64
62
|
microgrid_id = 1
|
|
65
|
-
|
|
63
|
+
|
|
64
|
+
dispatcher = Dispatcher(
|
|
65
|
+
microgrid_id=microgrid_id,
|
|
66
|
+
server_url=url,
|
|
67
|
+
key=key
|
|
68
|
+
)
|
|
66
69
|
await dispatcher.start()
|
|
67
70
|
|
|
68
71
|
actor = MagicMock() # replace with your actor
|
|
@@ -21,17 +21,20 @@ The [`Dispatcher` class](https://frequenz-floss.github.io/frequenz-dispatch-pyth
|
|
|
21
21
|
|
|
22
22
|
```python
|
|
23
23
|
import os
|
|
24
|
-
import
|
|
24
|
+
from frequenz.dispatch import Dispatcher, RunningState
|
|
25
25
|
from unittest.mock import MagicMock
|
|
26
26
|
|
|
27
27
|
async def run():
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
url = os.getenv("DISPATCH_API_URL", "grpc://fz-0004.frequenz.io:50051")
|
|
29
|
+
key = os.getenv("DISPATCH_API_KEY", "some-key")
|
|
30
30
|
|
|
31
|
-
service_address = f"{host}:{port}"
|
|
32
|
-
grpc_channel = grpc.aio.insecure_channel(service_address)
|
|
33
31
|
microgrid_id = 1
|
|
34
|
-
|
|
32
|
+
|
|
33
|
+
dispatcher = Dispatcher(
|
|
34
|
+
microgrid_id=microgrid_id,
|
|
35
|
+
server_url=url,
|
|
36
|
+
key=key
|
|
37
|
+
)
|
|
35
38
|
await dispatcher.start()
|
|
36
39
|
|
|
37
40
|
actor = MagicMock() # replace with your actor
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Dispatch Highlevel Interface Release Notes
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
<!-- Here goes a general summary of what this release is about -->
|
|
6
|
+
|
|
7
|
+
## Upgrading
|
|
8
|
+
|
|
9
|
+
- The dispatch high level interface now depends on `frequenz-sdk` version `v1.0.0-rc900`.
|
|
10
|
+
- We are now using the version `0.6.0` of the underlying `frequenz-client-dispatch` client library.
|
|
11
|
+
- The init parameter of the `Dispatcher` class has been changed to accept a `server_url` instead.
|
|
12
|
+
|
|
13
|
+
## New Features
|
|
14
|
+
|
|
15
|
+
* Using the new dispatch client, we now have support for pagination in the dispatch list request.
|
|
16
|
+
* The new client version also supports streaming, however it is not yet used internally in the high level interface.
|
|
17
|
+
|
|
18
|
+
## Bug Fixes
|
|
19
|
+
|
|
20
|
+
- Fix documentation cross-linking to the `frequenz-client-dispatch` package.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
requires = [
|
|
6
6
|
"setuptools == 68.1.0",
|
|
7
7
|
"setuptools_scm[toml] == 7.1.0",
|
|
8
|
-
"frequenz-repo-config[lib] == 0.
|
|
8
|
+
"frequenz-repo-config[lib] == 0.10.0",
|
|
9
9
|
]
|
|
10
10
|
build-backend = "setuptools.build_meta"
|
|
11
11
|
|
|
@@ -35,16 +35,13 @@ classifiers = [
|
|
|
35
35
|
requires-python = ">= 3.11, < 4"
|
|
36
36
|
dependencies = [
|
|
37
37
|
"python-dateutil >= 2.8.2, < 3.0",
|
|
38
|
-
"typing-extensions
|
|
38
|
+
"typing-extensions >= 4.11.0, < 5.0.0",
|
|
39
39
|
# Make sure to update the version for cross-referencing also in the
|
|
40
40
|
# mkdocs.yml file when changing the version here (look for the config key
|
|
41
41
|
# plugins.mkdocstrings.handlers.python.import)
|
|
42
|
-
"frequenz-sdk ==
|
|
43
|
-
"frequenz-channels
|
|
44
|
-
"frequenz-
|
|
45
|
-
"frequenz-client-dispatch == 0.2.0",
|
|
46
|
-
"frequenz-client-base >= 0.3.0, < 0.4.0",
|
|
47
|
-
"frequenz-client-common >= 0.1.0, < 0.2.0",
|
|
42
|
+
"frequenz-sdk == 1.0.0-rc900",
|
|
43
|
+
"frequenz-channels >= 1.1.0, < 2.0.0",
|
|
44
|
+
"frequenz-client-dispatch >= 0.6.0, < 0.7.0",
|
|
48
45
|
]
|
|
49
46
|
dynamic = ["version"]
|
|
50
47
|
|
|
@@ -54,48 +51,50 @@ email = "floss@frequenz.com"
|
|
|
54
51
|
|
|
55
52
|
[project.optional-dependencies]
|
|
56
53
|
dev-flake8 = [
|
|
57
|
-
"flake8 == 7.
|
|
54
|
+
"flake8 == 7.1.1",
|
|
58
55
|
"flake8-docstrings == 1.7.0",
|
|
59
56
|
"flake8-pyproject == 1.2.3", # For reading the flake8 config from pyproject.toml
|
|
60
|
-
"pydoclint == 0.
|
|
57
|
+
"pydoclint == 0.5.6",
|
|
61
58
|
"pydocstyle == 6.3.0",
|
|
62
59
|
]
|
|
63
|
-
dev-formatting = ["black == 24.
|
|
60
|
+
dev-formatting = ["black == 24.8.0", "isort == 5.13.2"]
|
|
64
61
|
dev-mkdocs = [
|
|
65
|
-
"black == 24.
|
|
66
|
-
"Markdown==3.
|
|
67
|
-
"mike == 2.1.
|
|
62
|
+
"black == 24.8.0",
|
|
63
|
+
"Markdown==3.7",
|
|
64
|
+
"mike == 2.1.3",
|
|
68
65
|
"mkdocs-gen-files == 0.5.0",
|
|
69
66
|
"mkdocs-literate-nav == 0.6.1",
|
|
70
67
|
"mkdocs-macros-plugin == 1.0.5",
|
|
71
|
-
"mkdocs-material == 9.5.
|
|
72
|
-
"mkdocstrings[python] == 0.25.
|
|
73
|
-
"
|
|
68
|
+
"mkdocs-material == 9.5.34",
|
|
69
|
+
"mkdocstrings[python] == 0.25.2",
|
|
70
|
+
"mkdocstrings-python == 1.10.9",
|
|
71
|
+
"frequenz-repo-config[lib] == 0.10.0",
|
|
74
72
|
]
|
|
75
73
|
dev-mypy = [
|
|
76
|
-
"mypy == 1.
|
|
77
|
-
"
|
|
78
|
-
"types-
|
|
74
|
+
"mypy == 1.11.2",
|
|
75
|
+
"grpc-stubs == 1.53.0.5", # This dependency introduces breaking changes in patch releases
|
|
76
|
+
"types-Markdown == 3.7.0.20240822",
|
|
77
|
+
"types-python-dateutil==2.9.0.20240821",
|
|
79
78
|
# For checking the noxfile, docs/ script, and tests
|
|
80
79
|
"frequenz-dispatch[dev-mkdocs,dev-noxfile,dev-pytest]",
|
|
81
80
|
]
|
|
82
81
|
dev-noxfile = [
|
|
83
|
-
"uv == 0.1
|
|
82
|
+
"uv == 0.4.1",
|
|
84
83
|
"nox == 2024.4.15",
|
|
85
|
-
"frequenz-repo-config[lib] == 0.
|
|
84
|
+
"frequenz-repo-config[lib] == 0.10.0",
|
|
86
85
|
]
|
|
87
86
|
dev-pylint = [
|
|
88
|
-
"pylint == 3.
|
|
87
|
+
"pylint == 3.2.7",
|
|
89
88
|
# For checking the noxfile, docs/ script, and tests
|
|
90
89
|
"frequenz-dispatch[dev-mkdocs,dev-noxfile,dev-pytest]",
|
|
91
90
|
]
|
|
92
91
|
dev-pytest = [
|
|
93
|
-
"pytest == 8.2
|
|
94
|
-
"frequenz-repo-config[extra-lint-examples] == 0.
|
|
92
|
+
"pytest == 8.3.2",
|
|
93
|
+
"frequenz-repo-config[extra-lint-examples] == 0.10.0",
|
|
95
94
|
"pytest-mock == 3.14.0",
|
|
96
|
-
"pytest-asyncio == 0.
|
|
97
|
-
"async-solipsism == 0.
|
|
98
|
-
"time-machine == 2.
|
|
95
|
+
"pytest-asyncio == 0.24.0",
|
|
96
|
+
"async-solipsism == 0.7",
|
|
97
|
+
"time-machine == 2.15.0",
|
|
99
98
|
]
|
|
100
99
|
dev = [
|
|
101
100
|
"frequenz-dispatch[dev-mkdocs,dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]",
|
|
@@ -151,8 +150,12 @@ disable = [
|
|
|
151
150
|
# pylint's unsubscriptable check is buggy and is not needed because
|
|
152
151
|
# it is a type-check, for which we already have mypy.
|
|
153
152
|
"unsubscriptable-object",
|
|
153
|
+
# Checked by mypy
|
|
154
|
+
"no-member",
|
|
154
155
|
# Checked by flake8
|
|
156
|
+
"f-string-without-interpolation",
|
|
155
157
|
"line-too-long",
|
|
158
|
+
"missing-function-docstring",
|
|
156
159
|
"redefined-outer-name",
|
|
157
160
|
"unnecessary-lambda-assignment",
|
|
158
161
|
"unused-import",
|
|
@@ -177,7 +180,13 @@ packages = ["frequenz.dispatch"]
|
|
|
177
180
|
strict = true
|
|
178
181
|
|
|
179
182
|
[[tool.mypy.overrides]]
|
|
180
|
-
module = [
|
|
183
|
+
module = [
|
|
184
|
+
"mkdocs_macros.*",
|
|
185
|
+
"async_solipsism",
|
|
186
|
+
"async_solipsism.*",
|
|
187
|
+
"grpc.aio",
|
|
188
|
+
"grpc.aio.*",
|
|
189
|
+
]
|
|
181
190
|
ignore_missing_imports = true
|
|
182
191
|
|
|
183
192
|
[tool.setuptools_scm]
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import abc
|
|
7
7
|
from typing import Protocol, TypeVar
|
|
8
8
|
|
|
9
|
-
import grpc.aio
|
|
10
9
|
from frequenz.channels import Broadcast, Receiver
|
|
11
10
|
from frequenz.client.dispatch import Client
|
|
12
11
|
|
|
@@ -55,18 +54,20 @@ class Dispatcher:
|
|
|
55
54
|
Example: Processing running state change dispatches
|
|
56
55
|
```python
|
|
57
56
|
import os
|
|
58
|
-
import grpc.aio
|
|
59
57
|
from frequenz.dispatch import Dispatcher, RunningState
|
|
60
58
|
from unittest.mock import MagicMock
|
|
61
59
|
|
|
62
60
|
async def run():
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
url = os.getenv("DISPATCH_API_URL", "grpc://fz-0004.frequenz.io:50051")
|
|
62
|
+
key = os.getenv("DISPATCH_API_KEY", "some-key")
|
|
65
63
|
|
|
66
|
-
service_address = f"{host}:{port}"
|
|
67
|
-
grpc_channel = grpc.aio.insecure_channel(service_address)
|
|
68
64
|
microgrid_id = 1
|
|
69
|
-
|
|
65
|
+
|
|
66
|
+
dispatcher = Dispatcher(
|
|
67
|
+
microgrid_id=microgrid_id,
|
|
68
|
+
server_url=url,
|
|
69
|
+
key=key
|
|
70
|
+
)
|
|
70
71
|
await dispatcher.start()
|
|
71
72
|
|
|
72
73
|
actor = MagicMock() # replace with your actor
|
|
@@ -104,18 +105,20 @@ class Dispatcher:
|
|
|
104
105
|
import os
|
|
105
106
|
from typing import assert_never
|
|
106
107
|
|
|
107
|
-
import grpc.aio
|
|
108
108
|
from frequenz.dispatch import Created, Deleted, Dispatcher, Updated
|
|
109
109
|
|
|
110
110
|
async def run():
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
url = os.getenv("DISPATCH_API_URL", "grpc://fz-0004.frequenz.io:50051")
|
|
112
|
+
key = os.getenv("DISPATCH_API_KEY", "some-key")
|
|
113
113
|
|
|
114
|
-
service_address = f"{host}:{port}"
|
|
115
|
-
grpc_channel = grpc.aio.insecure_channel(service_address)
|
|
116
114
|
microgrid_id = 1
|
|
117
|
-
|
|
118
|
-
dispatcher
|
|
115
|
+
|
|
116
|
+
dispatcher = Dispatcher(
|
|
117
|
+
microgrid_id=microgrid_id,
|
|
118
|
+
server_url=url,
|
|
119
|
+
key=key
|
|
120
|
+
)
|
|
121
|
+
await dispatcher.start() # this will start the actor
|
|
119
122
|
|
|
120
123
|
events_receiver = dispatcher.lifecycle_events.new_receiver()
|
|
121
124
|
|
|
@@ -138,25 +141,27 @@ class Dispatcher:
|
|
|
138
141
|
import os
|
|
139
142
|
from datetime import datetime, timedelta, timezone
|
|
140
143
|
|
|
141
|
-
import grpc.aio
|
|
142
144
|
from frequenz.client.common.microgrid.components import ComponentCategory
|
|
143
145
|
|
|
144
146
|
from frequenz.dispatch import Dispatcher
|
|
145
147
|
|
|
146
148
|
async def run():
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
url = os.getenv("DISPATCH_API_URL", "grpc://fz-0004.frequenz.io:50051")
|
|
150
|
+
key = os.getenv("DISPATCH_API_KEY", "some-key")
|
|
149
151
|
|
|
150
|
-
service_address = f"{host}:{port}"
|
|
151
|
-
grpc_channel = grpc.aio.insecure_channel(service_address)
|
|
152
152
|
microgrid_id = 1
|
|
153
|
-
|
|
153
|
+
|
|
154
|
+
dispatcher = Dispatcher(
|
|
155
|
+
microgrid_id=microgrid_id,
|
|
156
|
+
server_url=url,
|
|
157
|
+
key=key
|
|
158
|
+
)
|
|
154
159
|
await dispatcher.start() # this will start the actor
|
|
155
160
|
|
|
156
161
|
# Create a new dispatch
|
|
157
162
|
new_dispatch = await dispatcher.client.create(
|
|
158
163
|
microgrid_id=microgrid_id,
|
|
159
|
-
|
|
164
|
+
type="ECHO_FREQUENCY", # replace with your own type
|
|
160
165
|
start_time=datetime.now(tz=timezone.utc) + timedelta(minutes=10),
|
|
161
166
|
duration=timedelta(minutes=5),
|
|
162
167
|
selector=ComponentCategory.INVERTER,
|
|
@@ -165,30 +170,38 @@ class Dispatcher:
|
|
|
165
170
|
|
|
166
171
|
# Modify the dispatch
|
|
167
172
|
await dispatcher.client.update(
|
|
168
|
-
|
|
173
|
+
microgrid_id=microgrid_id,
|
|
174
|
+
dispatch_id=new_dispatch.id,
|
|
175
|
+
new_fields={"duration": timedelta(minutes=10)}
|
|
169
176
|
)
|
|
170
177
|
|
|
171
178
|
# Validate the modification
|
|
172
|
-
modified_dispatch = await dispatcher.client.get(
|
|
179
|
+
modified_dispatch = await dispatcher.client.get(
|
|
180
|
+
microgrid_id=microgrid_id, dispatch_id=new_dispatch.id
|
|
181
|
+
)
|
|
173
182
|
assert modified_dispatch.duration == timedelta(minutes=10)
|
|
174
183
|
```
|
|
175
184
|
"""
|
|
176
185
|
|
|
177
186
|
def __init__(
|
|
178
|
-
self,
|
|
187
|
+
self,
|
|
188
|
+
*,
|
|
189
|
+
microgrid_id: int,
|
|
190
|
+
server_url: str,
|
|
191
|
+
key: str,
|
|
179
192
|
):
|
|
180
193
|
"""Initialize the dispatcher.
|
|
181
194
|
|
|
182
195
|
Args:
|
|
183
196
|
microgrid_id: The microgrid id.
|
|
184
|
-
|
|
185
|
-
|
|
197
|
+
server_url: The URL of the dispatch service.
|
|
198
|
+
key: The key to access the service.
|
|
186
199
|
"""
|
|
187
200
|
self._running_state_channel = Broadcast[Dispatch](name="running_state_change")
|
|
188
201
|
self._lifecycle_events_channel = Broadcast[DispatchEvent](
|
|
189
202
|
name="lifecycle_events"
|
|
190
203
|
)
|
|
191
|
-
self._client = Client(
|
|
204
|
+
self._client = Client(server_url=server_url, key=key)
|
|
192
205
|
self._actor = DispatchingActor(
|
|
193
206
|
microgrid_id,
|
|
194
207
|
self._client,
|
|
@@ -89,28 +89,27 @@ class DispatchingActor(Actor):
|
|
|
89
89
|
|
|
90
90
|
try:
|
|
91
91
|
_logger.info("Fetching dispatches for microgrid %s", self._microgrid_id)
|
|
92
|
-
async for
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
await self._send_running_state_change(dispatch)
|
|
92
|
+
async for page in self._client.list(microgrid_id=self._microgrid_id):
|
|
93
|
+
for client_dispatch in page:
|
|
94
|
+
dispatch = Dispatch(client_dispatch)
|
|
95
|
+
|
|
96
|
+
self._dispatches[dispatch.id] = Dispatch(client_dispatch)
|
|
97
|
+
old_dispatch = old_dispatches.pop(dispatch.id, None)
|
|
98
|
+
if not old_dispatch:
|
|
99
|
+
self._update_dispatch_schedule(dispatch, None)
|
|
100
|
+
_logger.info("New dispatch: %s", dispatch)
|
|
101
|
+
await self._lifecycle_updates_sender.send(
|
|
102
|
+
Created(dispatch=dispatch)
|
|
103
|
+
)
|
|
104
|
+
elif dispatch.update_time != old_dispatch.update_time:
|
|
105
|
+
self._update_dispatch_schedule(dispatch, old_dispatch)
|
|
106
|
+
_logger.info("Updated dispatch: %s", dispatch)
|
|
107
|
+
await self._lifecycle_updates_sender.send(
|
|
108
|
+
Updated(dispatch=dispatch)
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
if self._running_state_change(dispatch, old_dispatch):
|
|
112
|
+
await self._send_running_state_change(dispatch)
|
|
114
113
|
|
|
115
114
|
except grpc.aio.AioRpcError as error:
|
|
116
115
|
_logger.error("Error fetching dispatches: %s", error)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: frequenz-dispatch
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.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
|
|
@@ -52,17 +52,20 @@ The [`Dispatcher` class](https://frequenz-floss.github.io/frequenz-dispatch-pyth
|
|
|
52
52
|
|
|
53
53
|
```python
|
|
54
54
|
import os
|
|
55
|
-
import
|
|
55
|
+
from frequenz.dispatch import Dispatcher, RunningState
|
|
56
56
|
from unittest.mock import MagicMock
|
|
57
57
|
|
|
58
58
|
async def run():
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
url = os.getenv("DISPATCH_API_URL", "grpc://fz-0004.frequenz.io:50051")
|
|
60
|
+
key = os.getenv("DISPATCH_API_KEY", "some-key")
|
|
61
61
|
|
|
62
|
-
service_address = f"{host}:{port}"
|
|
63
|
-
grpc_channel = grpc.aio.insecure_channel(service_address)
|
|
64
62
|
microgrid_id = 1
|
|
65
|
-
|
|
63
|
+
|
|
64
|
+
dispatcher = Dispatcher(
|
|
65
|
+
microgrid_id=microgrid_id,
|
|
66
|
+
server_url=url,
|
|
67
|
+
key=key
|
|
68
|
+
)
|
|
66
69
|
await dispatcher.start()
|
|
67
70
|
|
|
68
71
|
actor = MagicMock() # replace with your actor
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
python-dateutil<3.0,>=2.8.2
|
|
2
|
+
typing-extensions<5.0.0,>=4.11.0
|
|
3
|
+
frequenz-sdk==1.0.0-rc900
|
|
4
|
+
frequenz-channels<2.0.0,>=1.1.0
|
|
5
|
+
frequenz-client-dispatch<0.7.0,>=0.6.0
|
|
6
|
+
|
|
7
|
+
[dev]
|
|
8
|
+
frequenz-dispatch[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]
|
|
9
|
+
|
|
10
|
+
[dev-flake8]
|
|
11
|
+
flake8==7.1.1
|
|
12
|
+
flake8-docstrings==1.7.0
|
|
13
|
+
flake8-pyproject==1.2.3
|
|
14
|
+
pydoclint==0.5.6
|
|
15
|
+
pydocstyle==6.3.0
|
|
16
|
+
|
|
17
|
+
[dev-formatting]
|
|
18
|
+
black==24.8.0
|
|
19
|
+
isort==5.13.2
|
|
20
|
+
|
|
21
|
+
[dev-mkdocs]
|
|
22
|
+
black==24.8.0
|
|
23
|
+
Markdown==3.7
|
|
24
|
+
mike==2.1.3
|
|
25
|
+
mkdocs-gen-files==0.5.0
|
|
26
|
+
mkdocs-literate-nav==0.6.1
|
|
27
|
+
mkdocs-macros-plugin==1.0.5
|
|
28
|
+
mkdocs-material==9.5.34
|
|
29
|
+
mkdocstrings[python]==0.25.2
|
|
30
|
+
mkdocstrings-python==1.10.9
|
|
31
|
+
frequenz-repo-config[lib]==0.10.0
|
|
32
|
+
|
|
33
|
+
[dev-mypy]
|
|
34
|
+
mypy==1.11.2
|
|
35
|
+
grpc-stubs==1.53.0.5
|
|
36
|
+
types-Markdown==3.7.0.20240822
|
|
37
|
+
types-python-dateutil==2.9.0.20240821
|
|
38
|
+
frequenz-dispatch[dev-mkdocs,dev-noxfile,dev-pytest]
|
|
39
|
+
|
|
40
|
+
[dev-noxfile]
|
|
41
|
+
uv==0.4.1
|
|
42
|
+
nox==2024.4.15
|
|
43
|
+
frequenz-repo-config[lib]==0.10.0
|
|
44
|
+
|
|
45
|
+
[dev-pylint]
|
|
46
|
+
pylint==3.2.7
|
|
47
|
+
frequenz-dispatch[dev-mkdocs,dev-noxfile,dev-pytest]
|
|
48
|
+
|
|
49
|
+
[dev-pytest]
|
|
50
|
+
pytest==8.3.2
|
|
51
|
+
frequenz-repo-config[extra-lint-examples]==0.10.0
|
|
52
|
+
pytest-mock==3.14.0
|
|
53
|
+
pytest-asyncio==0.24.0
|
|
54
|
+
async-solipsism==0.7
|
|
55
|
+
time-machine==2.15.0
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Dispatch Highlevel Interface Release Notes
|
|
2
|
-
|
|
3
|
-
## Summary
|
|
4
|
-
|
|
5
|
-
This is the first release of the highlevel dispatch interface!
|
|
6
|
-
|
|
7
|
-
## Upgrading
|
|
8
|
-
|
|
9
|
-
* `Dispatcher.ready_to_execute()` was renamed to `Dispatcher.running_status_change()`
|
|
10
|
-
|
|
11
|
-
## New Features
|
|
12
|
-
|
|
13
|
-
* Introduced new class `Dispatch` (based on the client class) that contains useful functions and extended information about the received dispatch.
|
|
14
|
-
* `Dispatcher.client` was added to provide an easy access to the client for updating, deleting and creating dispatches
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
python-dateutil<3.0,>=2.8.2
|
|
2
|
-
typing-extensions==4.11.0
|
|
3
|
-
frequenz-sdk==v1.0.0-rc6
|
|
4
|
-
frequenz-channels==1.0.0
|
|
5
|
-
frequenz-api-dispatch<0.14,>=0.13.0
|
|
6
|
-
frequenz-client-dispatch==0.2.0
|
|
7
|
-
frequenz-client-base<0.4.0,>=0.3.0
|
|
8
|
-
frequenz-client-common<0.2.0,>=0.1.0
|
|
9
|
-
|
|
10
|
-
[dev]
|
|
11
|
-
frequenz-dispatch[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]
|
|
12
|
-
|
|
13
|
-
[dev-flake8]
|
|
14
|
-
flake8==7.0.0
|
|
15
|
-
flake8-docstrings==1.7.0
|
|
16
|
-
flake8-pyproject==1.2.3
|
|
17
|
-
pydoclint==0.4.1
|
|
18
|
-
pydocstyle==6.3.0
|
|
19
|
-
|
|
20
|
-
[dev-formatting]
|
|
21
|
-
black==24.4.2
|
|
22
|
-
isort==5.13.2
|
|
23
|
-
|
|
24
|
-
[dev-mkdocs]
|
|
25
|
-
black==24.4.2
|
|
26
|
-
Markdown==3.6
|
|
27
|
-
mike==2.1.0
|
|
28
|
-
mkdocs-gen-files==0.5.0
|
|
29
|
-
mkdocs-literate-nav==0.6.1
|
|
30
|
-
mkdocs-macros-plugin==1.0.5
|
|
31
|
-
mkdocs-material==9.5.20
|
|
32
|
-
mkdocstrings[python]==0.25.0
|
|
33
|
-
frequenz-repo-config[lib]==0.9.2
|
|
34
|
-
|
|
35
|
-
[dev-mypy]
|
|
36
|
-
mypy==1.10.0
|
|
37
|
-
types-Markdown==3.6.0.20240316
|
|
38
|
-
types-python-dateutil==2.9.0.20240316
|
|
39
|
-
frequenz-dispatch[dev-mkdocs,dev-noxfile,dev-pytest]
|
|
40
|
-
|
|
41
|
-
[dev-noxfile]
|
|
42
|
-
uv==0.1.39
|
|
43
|
-
nox==2024.4.15
|
|
44
|
-
frequenz-repo-config[lib]==0.9.2
|
|
45
|
-
|
|
46
|
-
[dev-pylint]
|
|
47
|
-
pylint==3.1.0
|
|
48
|
-
frequenz-dispatch[dev-mkdocs,dev-noxfile,dev-pytest]
|
|
49
|
-
|
|
50
|
-
[dev-pytest]
|
|
51
|
-
pytest==8.2.0
|
|
52
|
-
frequenz-repo-config[extra-lint-examples]==0.9.2
|
|
53
|
-
pytest-mock==3.14.0
|
|
54
|
-
pytest-asyncio==0.23.6
|
|
55
|
-
async-solipsism==0.6
|
|
56
|
-
time-machine==2.14.1
|
|
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.1.0 → frequenz-dispatch-0.3.0}/src/frequenz_dispatch.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{frequenz-dispatch-0.1.0 → frequenz-dispatch-0.3.0}/src/frequenz_dispatch.egg-info/top_level.txt
RENAMED
|
File without changes
|