frequenz-dispatch 0.1.0__tar.gz → 0.2.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.2.0}/PKG-INFO +1 -1
- frequenz-dispatch-0.2.0/RELEASE_NOTES.md +5 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/pyproject.toml +15 -18
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/src/frequenz/dispatch/_dispatcher.py +51 -15
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0/src/frequenz_dispatch.egg-info}/PKG-INFO +1 -1
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/src/frequenz_dispatch.egg-info/requires.txt +15 -18
- frequenz-dispatch-0.1.0/RELEASE_NOTES.md +0 -14
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/LICENSE +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/MANIFEST.in +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/README.md +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/setup.cfg +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/src/frequenz/dispatch/__init__.py +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/src/frequenz/dispatch/_dispatch.py +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/src/frequenz/dispatch/_event.py +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/src/frequenz/dispatch/actor.py +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/src/frequenz/dispatch/conftest.py +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/src/frequenz/dispatch/py.typed +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/src/frequenz_dispatch.egg-info/SOURCES.txt +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/src/frequenz_dispatch.egg-info/dependency_links.txt +0 -0
- {frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/src/frequenz_dispatch.egg-info/top_level.txt +0 -0
|
@@ -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.0rc601",
|
|
43
|
+
"frequenz-channels >= 1.0.1, < 2.0.0",
|
|
44
|
+
"frequenz-client-dispatch >= 0.5.0, < 0.6.0",
|
|
48
45
|
]
|
|
49
46
|
dynamic = ["version"]
|
|
50
47
|
|
|
@@ -54,48 +51,48 @@ email = "floss@frequenz.com"
|
|
|
54
51
|
|
|
55
52
|
[project.optional-dependencies]
|
|
56
53
|
dev-flake8 = [
|
|
57
|
-
"flake8 == 7.
|
|
54
|
+
"flake8 == 7.1.0",
|
|
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.3",
|
|
61
58
|
"pydocstyle == 6.3.0",
|
|
62
59
|
]
|
|
63
60
|
dev-formatting = ["black == 24.4.2", "isort == 5.13.2"]
|
|
64
61
|
dev-mkdocs = [
|
|
65
62
|
"black == 24.4.2",
|
|
66
63
|
"Markdown==3.6",
|
|
67
|
-
"mike == 2.1.
|
|
64
|
+
"mike == 2.1.2",
|
|
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.
|
|
68
|
+
"mkdocs-material == 9.5.27",
|
|
69
|
+
"mkdocstrings[python] == 0.25.1",
|
|
73
70
|
"frequenz-repo-config[lib] == 0.9.2",
|
|
74
71
|
]
|
|
75
72
|
dev-mypy = [
|
|
76
|
-
"mypy == 1.10.
|
|
73
|
+
"mypy == 1.10.1",
|
|
77
74
|
"types-Markdown == 3.6.0.20240316",
|
|
78
75
|
"types-python-dateutil==2.9.0.20240316",
|
|
79
76
|
# For checking the noxfile, docs/ script, and tests
|
|
80
77
|
"frequenz-dispatch[dev-mkdocs,dev-noxfile,dev-pytest]",
|
|
81
78
|
]
|
|
82
79
|
dev-noxfile = [
|
|
83
|
-
"uv == 0.
|
|
80
|
+
"uv == 0.2.18",
|
|
84
81
|
"nox == 2024.4.15",
|
|
85
82
|
"frequenz-repo-config[lib] == 0.9.2",
|
|
86
83
|
]
|
|
87
84
|
dev-pylint = [
|
|
88
|
-
"pylint == 3.
|
|
85
|
+
"pylint == 3.2.5",
|
|
89
86
|
# For checking the noxfile, docs/ script, and tests
|
|
90
87
|
"frequenz-dispatch[dev-mkdocs,dev-noxfile,dev-pytest]",
|
|
91
88
|
]
|
|
92
89
|
dev-pytest = [
|
|
93
|
-
"pytest == 8.2.
|
|
90
|
+
"pytest == 8.2.2",
|
|
94
91
|
"frequenz-repo-config[extra-lint-examples] == 0.9.2",
|
|
95
92
|
"pytest-mock == 3.14.0",
|
|
96
|
-
"pytest-asyncio == 0.23.
|
|
93
|
+
"pytest-asyncio == 0.23.7",
|
|
97
94
|
"async-solipsism == 0.6",
|
|
98
|
-
"time-machine == 2.14.
|
|
95
|
+
"time-machine == 2.14.2",
|
|
99
96
|
]
|
|
100
97
|
dev = [
|
|
101
98
|
"frequenz-dispatch[dev-mkdocs,dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]",
|
|
@@ -62,11 +62,19 @@ class Dispatcher:
|
|
|
62
62
|
async def run():
|
|
63
63
|
host = os.getenv("DISPATCH_API_HOST", "localhost")
|
|
64
64
|
port = os.getenv("DISPATCH_API_PORT", "50051")
|
|
65
|
+
key = os.getenv("DISPATCH_API_KEY", "some-key")
|
|
65
66
|
|
|
66
67
|
service_address = f"{host}:{port}"
|
|
67
|
-
grpc_channel = grpc.aio.
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
grpc_channel = grpc.aio.secure_channel(
|
|
69
|
+
service_address,
|
|
70
|
+
credentials=grpc.ssl_channel_credentials()
|
|
71
|
+
)
|
|
72
|
+
dispatcher = Dispatcher(
|
|
73
|
+
microgrid_id=1,
|
|
74
|
+
grpc_channel=grpc_channel,
|
|
75
|
+
svc_addr=service_address,
|
|
76
|
+
key=key
|
|
77
|
+
)
|
|
70
78
|
await dispatcher.start()
|
|
71
79
|
|
|
72
80
|
actor = MagicMock() # replace with your actor
|
|
@@ -110,12 +118,20 @@ class Dispatcher:
|
|
|
110
118
|
async def run():
|
|
111
119
|
host = os.getenv("DISPATCH_API_HOST", "localhost")
|
|
112
120
|
port = os.getenv("DISPATCH_API_PORT", "50051")
|
|
121
|
+
key = os.getenv("DISPATCH_API_KEY", "some-key")
|
|
113
122
|
|
|
114
123
|
service_address = f"{host}:{port}"
|
|
115
|
-
grpc_channel = grpc.aio.
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
124
|
+
grpc_channel = grpc.aio.secure_channel(
|
|
125
|
+
service_address,
|
|
126
|
+
credentials=grpc.ssl_channel_credentials()
|
|
127
|
+
)
|
|
128
|
+
dispatcher = Dispatcher(
|
|
129
|
+
microgrid_id=1,
|
|
130
|
+
grpc_channel=grpc_channel,
|
|
131
|
+
svc_addr=service_address,
|
|
132
|
+
key=key
|
|
133
|
+
)
|
|
134
|
+
await dispatcher.start() # this will start the actor
|
|
119
135
|
|
|
120
136
|
events_receiver = dispatcher.lifecycle_events.new_receiver()
|
|
121
137
|
|
|
@@ -146,17 +162,27 @@ class Dispatcher:
|
|
|
146
162
|
async def run():
|
|
147
163
|
host = os.getenv("DISPATCH_API_HOST", "localhost")
|
|
148
164
|
port = os.getenv("DISPATCH_API_PORT", "50051")
|
|
165
|
+
key = os.getenv("DISPATCH_API_KEY", "some-key")
|
|
149
166
|
|
|
150
|
-
service_address = f"{host}:{port}"
|
|
151
|
-
grpc_channel = grpc.aio.insecure_channel(service_address)
|
|
152
167
|
microgrid_id = 1
|
|
153
|
-
|
|
168
|
+
|
|
169
|
+
service_address = f"{host}:{port}"
|
|
170
|
+
grpc_channel = grpc.aio.secure_channel(
|
|
171
|
+
service_address,
|
|
172
|
+
credentials=grpc.ssl_channel_credentials()
|
|
173
|
+
)
|
|
174
|
+
dispatcher = Dispatcher(
|
|
175
|
+
microgrid_id=microgrid_id,
|
|
176
|
+
grpc_channel=grpc_channel,
|
|
177
|
+
svc_addr=service_address,
|
|
178
|
+
key=key
|
|
179
|
+
)
|
|
154
180
|
await dispatcher.start() # this will start the actor
|
|
155
181
|
|
|
156
182
|
# Create a new dispatch
|
|
157
183
|
new_dispatch = await dispatcher.client.create(
|
|
158
184
|
microgrid_id=microgrid_id,
|
|
159
|
-
|
|
185
|
+
type="ECHO_FREQUENCY", # replace with your own type
|
|
160
186
|
start_time=datetime.now(tz=timezone.utc) + timedelta(minutes=10),
|
|
161
187
|
duration=timedelta(minutes=5),
|
|
162
188
|
selector=ComponentCategory.INVERTER,
|
|
@@ -165,17 +191,26 @@ class Dispatcher:
|
|
|
165
191
|
|
|
166
192
|
# Modify the dispatch
|
|
167
193
|
await dispatcher.client.update(
|
|
168
|
-
|
|
194
|
+
microgrid_id=microgrid_id,
|
|
195
|
+
dispatch_id=new_dispatch.id,
|
|
196
|
+
new_fields={"duration": timedelta(minutes=10)}
|
|
169
197
|
)
|
|
170
198
|
|
|
171
199
|
# Validate the modification
|
|
172
|
-
modified_dispatch = await dispatcher.client.get(
|
|
200
|
+
modified_dispatch = await dispatcher.client.get(
|
|
201
|
+
microgrid_id=microgrid_id, dispatch_id=new_dispatch.id
|
|
202
|
+
)
|
|
173
203
|
assert modified_dispatch.duration == timedelta(minutes=10)
|
|
174
204
|
```
|
|
175
205
|
"""
|
|
176
206
|
|
|
177
207
|
def __init__(
|
|
178
|
-
self,
|
|
208
|
+
self,
|
|
209
|
+
*,
|
|
210
|
+
microgrid_id: int,
|
|
211
|
+
grpc_channel: grpc.aio.Channel,
|
|
212
|
+
svc_addr: str,
|
|
213
|
+
key: str,
|
|
179
214
|
):
|
|
180
215
|
"""Initialize the dispatcher.
|
|
181
216
|
|
|
@@ -183,12 +218,13 @@ class Dispatcher:
|
|
|
183
218
|
microgrid_id: The microgrid id.
|
|
184
219
|
grpc_channel: The gRPC channel.
|
|
185
220
|
svc_addr: The service address.
|
|
221
|
+
key: The key to access the service.
|
|
186
222
|
"""
|
|
187
223
|
self._running_state_channel = Broadcast[Dispatch](name="running_state_change")
|
|
188
224
|
self._lifecycle_events_channel = Broadcast[DispatchEvent](
|
|
189
225
|
name="lifecycle_events"
|
|
190
226
|
)
|
|
191
|
-
self._client = Client(grpc_channel, svc_addr)
|
|
227
|
+
self._client = Client(grpc_channel=grpc_channel, svc_addr=svc_addr, key=key)
|
|
192
228
|
self._actor = DispatchingActor(
|
|
193
229
|
microgrid_id,
|
|
194
230
|
self._client,
|
{frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/src/frequenz_dispatch.egg-info/requires.txt
RENAMED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
python-dateutil<3.0,>=2.8.2
|
|
2
|
-
typing-extensions
|
|
3
|
-
frequenz-sdk==
|
|
4
|
-
frequenz-channels
|
|
5
|
-
frequenz-
|
|
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
|
|
2
|
+
typing-extensions<5.0.0,>=4.11.0
|
|
3
|
+
frequenz-sdk==1.0.0rc601
|
|
4
|
+
frequenz-channels<2.0.0,>=1.0.1
|
|
5
|
+
frequenz-client-dispatch<0.6.0,>=0.5.0
|
|
9
6
|
|
|
10
7
|
[dev]
|
|
11
8
|
frequenz-dispatch[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]
|
|
12
9
|
|
|
13
10
|
[dev-flake8]
|
|
14
|
-
flake8==7.
|
|
11
|
+
flake8==7.1.0
|
|
15
12
|
flake8-docstrings==1.7.0
|
|
16
13
|
flake8-pyproject==1.2.3
|
|
17
|
-
pydoclint==0.
|
|
14
|
+
pydoclint==0.5.3
|
|
18
15
|
pydocstyle==6.3.0
|
|
19
16
|
|
|
20
17
|
[dev-formatting]
|
|
@@ -24,33 +21,33 @@ isort==5.13.2
|
|
|
24
21
|
[dev-mkdocs]
|
|
25
22
|
black==24.4.2
|
|
26
23
|
Markdown==3.6
|
|
27
|
-
mike==2.1.
|
|
24
|
+
mike==2.1.2
|
|
28
25
|
mkdocs-gen-files==0.5.0
|
|
29
26
|
mkdocs-literate-nav==0.6.1
|
|
30
27
|
mkdocs-macros-plugin==1.0.5
|
|
31
|
-
mkdocs-material==9.5.
|
|
32
|
-
mkdocstrings[python]==0.25.
|
|
28
|
+
mkdocs-material==9.5.27
|
|
29
|
+
mkdocstrings[python]==0.25.1
|
|
33
30
|
frequenz-repo-config[lib]==0.9.2
|
|
34
31
|
|
|
35
32
|
[dev-mypy]
|
|
36
|
-
mypy==1.10.
|
|
33
|
+
mypy==1.10.1
|
|
37
34
|
types-Markdown==3.6.0.20240316
|
|
38
35
|
types-python-dateutil==2.9.0.20240316
|
|
39
36
|
frequenz-dispatch[dev-mkdocs,dev-noxfile,dev-pytest]
|
|
40
37
|
|
|
41
38
|
[dev-noxfile]
|
|
42
|
-
uv==0.
|
|
39
|
+
uv==0.2.18
|
|
43
40
|
nox==2024.4.15
|
|
44
41
|
frequenz-repo-config[lib]==0.9.2
|
|
45
42
|
|
|
46
43
|
[dev-pylint]
|
|
47
|
-
pylint==3.
|
|
44
|
+
pylint==3.2.5
|
|
48
45
|
frequenz-dispatch[dev-mkdocs,dev-noxfile,dev-pytest]
|
|
49
46
|
|
|
50
47
|
[dev-pytest]
|
|
51
|
-
pytest==8.2.
|
|
48
|
+
pytest==8.2.2
|
|
52
49
|
frequenz-repo-config[extra-lint-examples]==0.9.2
|
|
53
50
|
pytest-mock==3.14.0
|
|
54
|
-
pytest-asyncio==0.23.
|
|
51
|
+
pytest-asyncio==0.23.7
|
|
55
52
|
async-solipsism==0.6
|
|
56
|
-
time-machine==2.14.
|
|
53
|
+
time-machine==2.14.2
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
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.2.0}/src/frequenz_dispatch.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{frequenz-dispatch-0.1.0 → frequenz-dispatch-0.2.0}/src/frequenz_dispatch.egg-info/top_level.txt
RENAMED
|
File without changes
|