flwr-nightly 1.13.0.dev20241101__py3-none-any.whl → 1.13.0.dev20241102__py3-none-any.whl
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.
Potentially problematic release.
This version of flwr-nightly might be problematic. Click here for more details.
- flwr/cli/config_utils.py +98 -0
- flwr/cli/log.py +19 -82
- flwr/cli/run/run.py +18 -83
- flwr/client/clientapp/app.py +1 -2
- flwr/common/constant.py +1 -1
- flwr/common/logger.py +3 -3
- flwr/common/telemetry.py +0 -6
- flwr/proto/serverappio_pb2.py +52 -0
- flwr/proto/{driver_pb2_grpc.py → serverappio_pb2_grpc.py} +56 -56
- flwr/proto/{driver_pb2_grpc.pyi → serverappio_pb2_grpc.pyi} +24 -24
- flwr/server/app.py +20 -20
- flwr/server/driver/driver.py +1 -1
- flwr/server/driver/grpc_driver.py +18 -18
- flwr/server/driver/inmemory_driver.py +1 -1
- flwr/server/run_serverapp.py +11 -11
- flwr/server/serverapp/app.py +4 -5
- flwr/server/strategy/fedadam.py +11 -1
- flwr/server/superlink/driver/__init__.py +1 -1
- flwr/server/superlink/driver/{driver_grpc.py → serverappio_grpc.py} +17 -14
- flwr/server/superlink/driver/{driver_servicer.py → serverappio_servicer.py} +29 -32
- flwr/server/superlink/fleet/grpc_bidi/grpc_server.py +2 -2
- flwr/server/superlink/linkstate/linkstate.py +3 -3
- flwr/server/superlink/linkstate/sqlite_linkstate.py +3 -3
- flwr/superexec/deployment.py +3 -3
- {flwr_nightly-1.13.0.dev20241101.dist-info → flwr_nightly-1.13.0.dev20241102.dist-info}/METADATA +1 -1
- {flwr_nightly-1.13.0.dev20241101.dist-info → flwr_nightly-1.13.0.dev20241102.dist-info}/RECORD +30 -30
- flwr/proto/driver_pb2.py +0 -52
- /flwr/proto/{driver_pb2.pyi → serverappio_pb2.pyi} +0 -0
- {flwr_nightly-1.13.0.dev20241101.dist-info → flwr_nightly-1.13.0.dev20241102.dist-info}/LICENSE +0 -0
- {flwr_nightly-1.13.0.dev20241101.dist-info → flwr_nightly-1.13.0.dev20241102.dist-info}/WHEEL +0 -0
- {flwr_nightly-1.13.0.dev20241101.dist-info → flwr_nightly-1.13.0.dev20241102.dist-info}/entry_points.txt +0 -0
flwr/cli/config_utils.py
CHANGED
|
@@ -20,6 +20,7 @@ from pathlib import Path
|
|
|
20
20
|
from typing import IO, Any, Optional, Union, get_args
|
|
21
21
|
|
|
22
22
|
import tomli
|
|
23
|
+
import typer
|
|
23
24
|
|
|
24
25
|
from flwr.common import object_ref
|
|
25
26
|
from flwr.common.typing import UserConfigValue
|
|
@@ -227,3 +228,100 @@ def load_from_string(toml_content: str) -> Optional[dict[str, Any]]:
|
|
|
227
228
|
return data
|
|
228
229
|
except tomli.TOMLDecodeError:
|
|
229
230
|
return None
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def validate_project_config(
|
|
234
|
+
config: Union[dict[str, Any], None], errors: list[str], warnings: list[str]
|
|
235
|
+
) -> dict[str, Any]:
|
|
236
|
+
"""Validate and return the Flower project configuration."""
|
|
237
|
+
if config is None:
|
|
238
|
+
typer.secho(
|
|
239
|
+
"Project configuration could not be loaded.\n"
|
|
240
|
+
"pyproject.toml is invalid:\n"
|
|
241
|
+
+ "\n".join([f"- {line}" for line in errors]),
|
|
242
|
+
fg=typer.colors.RED,
|
|
243
|
+
bold=True,
|
|
244
|
+
)
|
|
245
|
+
raise typer.Exit(code=1)
|
|
246
|
+
|
|
247
|
+
if warnings:
|
|
248
|
+
typer.secho(
|
|
249
|
+
"Project configuration is missing the following "
|
|
250
|
+
"recommended properties:\n" + "\n".join([f"- {line}" for line in warnings]),
|
|
251
|
+
fg=typer.colors.RED,
|
|
252
|
+
bold=True,
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
typer.secho("Success", fg=typer.colors.GREEN)
|
|
256
|
+
|
|
257
|
+
return config
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def validate_federation_in_project_config(
|
|
261
|
+
federation: Optional[str], config: dict[str, Any]
|
|
262
|
+
) -> tuple[str, dict[str, Any]]:
|
|
263
|
+
"""Validate the federation name in the Flower project configuration."""
|
|
264
|
+
federation = federation or config["tool"]["flwr"]["federations"].get("default")
|
|
265
|
+
|
|
266
|
+
if federation is None:
|
|
267
|
+
typer.secho(
|
|
268
|
+
"❌ No federation name was provided and the project's `pyproject.toml` "
|
|
269
|
+
"doesn't declare a default federation (with an Exec API address or an "
|
|
270
|
+
"`options.num-supernodes` value).",
|
|
271
|
+
fg=typer.colors.RED,
|
|
272
|
+
bold=True,
|
|
273
|
+
)
|
|
274
|
+
raise typer.Exit(code=1)
|
|
275
|
+
|
|
276
|
+
# Validate the federation exists in the configuration
|
|
277
|
+
federation_config = config["tool"]["flwr"]["federations"].get(federation)
|
|
278
|
+
print(federation_config)
|
|
279
|
+
if federation_config is None:
|
|
280
|
+
available_feds = {
|
|
281
|
+
fed for fed in config["tool"]["flwr"]["federations"] if fed != "default"
|
|
282
|
+
}
|
|
283
|
+
typer.secho(
|
|
284
|
+
f"❌ There is no `{federation}` federation declared in the "
|
|
285
|
+
"`pyproject.toml`.\n The following federations were found:\n\n"
|
|
286
|
+
+ "\n".join(available_feds),
|
|
287
|
+
fg=typer.colors.RED,
|
|
288
|
+
bold=True,
|
|
289
|
+
)
|
|
290
|
+
raise typer.Exit(code=1)
|
|
291
|
+
|
|
292
|
+
return federation, federation_config
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def validate_certificate_in_federation_config(
|
|
296
|
+
app: Path, federation_config: dict[str, Any]
|
|
297
|
+
) -> tuple[bool, Optional[bytes]]:
|
|
298
|
+
"""Validate the certificates in the Flower project configuration."""
|
|
299
|
+
insecure_str = federation_config.get("insecure")
|
|
300
|
+
if root_certificates := federation_config.get("root-certificates"):
|
|
301
|
+
root_certificates_bytes = (app / root_certificates).read_bytes()
|
|
302
|
+
if insecure := bool(insecure_str):
|
|
303
|
+
typer.secho(
|
|
304
|
+
"❌ `root_certificates` were provided but the `insecure` parameter "
|
|
305
|
+
"is set to `True`.",
|
|
306
|
+
fg=typer.colors.RED,
|
|
307
|
+
bold=True,
|
|
308
|
+
)
|
|
309
|
+
raise typer.Exit(code=1)
|
|
310
|
+
else:
|
|
311
|
+
root_certificates_bytes = None
|
|
312
|
+
if insecure_str is None:
|
|
313
|
+
typer.secho(
|
|
314
|
+
"❌ To disable TLS, set `insecure = true` in `pyproject.toml`.",
|
|
315
|
+
fg=typer.colors.RED,
|
|
316
|
+
bold=True,
|
|
317
|
+
)
|
|
318
|
+
raise typer.Exit(code=1)
|
|
319
|
+
if not (insecure := bool(insecure_str)):
|
|
320
|
+
typer.secho(
|
|
321
|
+
"❌ No certificate were given yet `insecure` is set to `False`.",
|
|
322
|
+
fg=typer.colors.RED,
|
|
323
|
+
bold=True,
|
|
324
|
+
)
|
|
325
|
+
raise typer.Exit(code=1)
|
|
326
|
+
|
|
327
|
+
return insecure, root_certificates_bytes
|
flwr/cli/log.py
CHANGED
|
@@ -14,16 +14,20 @@
|
|
|
14
14
|
# ==============================================================================
|
|
15
15
|
"""Flower command line interface `log` command."""
|
|
16
16
|
|
|
17
|
-
import sys
|
|
18
17
|
import time
|
|
19
18
|
from logging import DEBUG, ERROR, INFO
|
|
20
19
|
from pathlib import Path
|
|
21
|
-
from typing import Annotated, Optional, cast
|
|
20
|
+
from typing import Annotated, Any, Optional, cast
|
|
22
21
|
|
|
23
22
|
import grpc
|
|
24
23
|
import typer
|
|
25
24
|
|
|
26
|
-
from flwr.cli.config_utils import
|
|
25
|
+
from flwr.cli.config_utils import (
|
|
26
|
+
load_and_validate,
|
|
27
|
+
validate_certificate_in_federation_config,
|
|
28
|
+
validate_federation_in_project_config,
|
|
29
|
+
validate_project_config,
|
|
30
|
+
)
|
|
27
31
|
from flwr.common.constant import CONN_RECONNECT_INTERVAL, CONN_REFRESH_PERIOD
|
|
28
32
|
from flwr.common.grpc import GRPC_MAX_MESSAGE_LENGTH, create_channel
|
|
29
33
|
from flwr.common.logger import log as logger
|
|
@@ -153,100 +157,33 @@ def log(
|
|
|
153
157
|
|
|
154
158
|
pyproject_path = app / "pyproject.toml" if app else None
|
|
155
159
|
config, errors, warnings = load_and_validate(path=pyproject_path)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
"pyproject.toml is invalid:\n"
|
|
161
|
-
+ "\n".join([f"- {line}" for line in errors]),
|
|
162
|
-
fg=typer.colors.RED,
|
|
163
|
-
bold=True,
|
|
164
|
-
)
|
|
165
|
-
sys.exit()
|
|
166
|
-
|
|
167
|
-
if warnings:
|
|
168
|
-
typer.secho(
|
|
169
|
-
"Project configuration is missing the following "
|
|
170
|
-
"recommended properties:\n" + "\n".join([f"- {line}" for line in warnings]),
|
|
171
|
-
fg=typer.colors.RED,
|
|
172
|
-
bold=True,
|
|
173
|
-
)
|
|
174
|
-
|
|
175
|
-
typer.secho("Success", fg=typer.colors.GREEN)
|
|
176
|
-
|
|
177
|
-
federation = federation or config["tool"]["flwr"]["federations"].get("default")
|
|
178
|
-
|
|
179
|
-
if federation is None:
|
|
180
|
-
typer.secho(
|
|
181
|
-
"❌ No federation name was provided and the project's `pyproject.toml` "
|
|
182
|
-
"doesn't declare a default federation (with a SuperExec address or an "
|
|
183
|
-
"`options.num-supernodes` value).",
|
|
184
|
-
fg=typer.colors.RED,
|
|
185
|
-
bold=True,
|
|
186
|
-
)
|
|
187
|
-
raise typer.Exit(code=1)
|
|
188
|
-
|
|
189
|
-
# Validate the federation exists in the configuration
|
|
190
|
-
federation_config = config["tool"]["flwr"]["federations"].get(federation)
|
|
191
|
-
if federation_config is None:
|
|
192
|
-
available_feds = {
|
|
193
|
-
fed for fed in config["tool"]["flwr"]["federations"] if fed != "default"
|
|
194
|
-
}
|
|
195
|
-
typer.secho(
|
|
196
|
-
f"❌ There is no `{federation}` federation declared in the "
|
|
197
|
-
"`pyproject.toml`.\n The following federations were found:\n\n"
|
|
198
|
-
+ "\n".join(available_feds),
|
|
199
|
-
fg=typer.colors.RED,
|
|
200
|
-
bold=True,
|
|
201
|
-
)
|
|
202
|
-
raise typer.Exit(code=1)
|
|
160
|
+
config = validate_project_config(config, errors, warnings)
|
|
161
|
+
federation, federation_config = validate_federation_in_project_config(
|
|
162
|
+
federation, config
|
|
163
|
+
)
|
|
203
164
|
|
|
204
165
|
if "address" not in federation_config:
|
|
205
166
|
typer.secho(
|
|
206
|
-
"❌ `flwr log` currently works with
|
|
207
|
-
"
|
|
167
|
+
"❌ `flwr log` currently works with Exec API. Ensure that the correct"
|
|
168
|
+
"Exec API address is provided in the `pyproject.toml`.",
|
|
208
169
|
fg=typer.colors.RED,
|
|
209
170
|
bold=True,
|
|
210
171
|
)
|
|
211
172
|
raise typer.Exit(code=1)
|
|
212
173
|
|
|
213
|
-
_log_with_exec_api(federation_config, run_id, stream)
|
|
174
|
+
_log_with_exec_api(app, federation_config, run_id, stream)
|
|
214
175
|
|
|
215
176
|
|
|
216
|
-
# pylint: disable-next=too-many-branches
|
|
217
177
|
def _log_with_exec_api(
|
|
218
|
-
|
|
178
|
+
app: Path,
|
|
179
|
+
federation_config: dict[str, Any],
|
|
219
180
|
run_id: int,
|
|
220
181
|
stream: bool,
|
|
221
182
|
) -> None:
|
|
222
|
-
insecure_str = federation_config.get("insecure")
|
|
223
|
-
if root_certificates := federation_config.get("root-certificates"):
|
|
224
|
-
root_certificates_bytes = Path(root_certificates).read_bytes()
|
|
225
|
-
if insecure := bool(insecure_str):
|
|
226
|
-
typer.secho(
|
|
227
|
-
"❌ `root_certificates` were provided but the `insecure` parameter"
|
|
228
|
-
"is set to `True`.",
|
|
229
|
-
fg=typer.colors.RED,
|
|
230
|
-
bold=True,
|
|
231
|
-
)
|
|
232
|
-
raise typer.Exit(code=1)
|
|
233
|
-
else:
|
|
234
|
-
root_certificates_bytes = None
|
|
235
|
-
if insecure_str is None:
|
|
236
|
-
typer.secho(
|
|
237
|
-
"❌ To disable TLS, set `insecure = true` in `pyproject.toml`.",
|
|
238
|
-
fg=typer.colors.RED,
|
|
239
|
-
bold=True,
|
|
240
|
-
)
|
|
241
|
-
raise typer.Exit(code=1)
|
|
242
|
-
if not (insecure := bool(insecure_str)):
|
|
243
|
-
typer.secho(
|
|
244
|
-
"❌ No certificate were given yet `insecure` is set to `False`.",
|
|
245
|
-
fg=typer.colors.RED,
|
|
246
|
-
bold=True,
|
|
247
|
-
)
|
|
248
|
-
raise typer.Exit(code=1)
|
|
249
183
|
|
|
184
|
+
insecure, root_certificates_bytes = validate_certificate_in_federation_config(
|
|
185
|
+
app, federation_config
|
|
186
|
+
)
|
|
250
187
|
channel = create_channel(
|
|
251
188
|
server_address=federation_config["address"],
|
|
252
189
|
insecure=insecure,
|
flwr/cli/run/run.py
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
import json
|
|
18
18
|
import subprocess
|
|
19
|
-
import sys
|
|
20
19
|
from logging import DEBUG
|
|
21
20
|
from pathlib import Path
|
|
22
21
|
from typing import Annotated, Any, Optional
|
|
@@ -24,7 +23,12 @@ from typing import Annotated, Any, Optional
|
|
|
24
23
|
import typer
|
|
25
24
|
|
|
26
25
|
from flwr.cli.build import build
|
|
27
|
-
from flwr.cli.config_utils import
|
|
26
|
+
from flwr.cli.config_utils import (
|
|
27
|
+
load_and_validate,
|
|
28
|
+
validate_certificate_in_federation_config,
|
|
29
|
+
validate_federation_in_project_config,
|
|
30
|
+
validate_project_config,
|
|
31
|
+
)
|
|
28
32
|
from flwr.common.config import flatten_dict, parse_config_args
|
|
29
33
|
from flwr.common.grpc import GRPC_MAX_MESSAGE_LENGTH, create_channel
|
|
30
34
|
from flwr.common.logger import log
|
|
@@ -79,96 +83,27 @@ def run(
|
|
|
79
83
|
|
|
80
84
|
pyproject_path = app / "pyproject.toml" if app else None
|
|
81
85
|
config, errors, warnings = load_and_validate(path=pyproject_path)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"pyproject.toml is invalid:\n"
|
|
87
|
-
+ "\n".join([f"- {line}" for line in errors]),
|
|
88
|
-
fg=typer.colors.RED,
|
|
89
|
-
bold=True,
|
|
90
|
-
)
|
|
91
|
-
sys.exit()
|
|
92
|
-
|
|
93
|
-
if warnings:
|
|
94
|
-
typer.secho(
|
|
95
|
-
"Project configuration is missing the following "
|
|
96
|
-
"recommended properties:\n" + "\n".join([f"- {line}" for line in warnings]),
|
|
97
|
-
fg=typer.colors.RED,
|
|
98
|
-
bold=True,
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
typer.secho("Success", fg=typer.colors.GREEN)
|
|
102
|
-
|
|
103
|
-
federation = federation or config["tool"]["flwr"]["federations"].get("default")
|
|
104
|
-
|
|
105
|
-
if federation is None:
|
|
106
|
-
typer.secho(
|
|
107
|
-
"❌ No federation name was provided and the project's `pyproject.toml` "
|
|
108
|
-
"doesn't declare a default federation (with a SuperExec address or an "
|
|
109
|
-
"`options.num-supernodes` value).",
|
|
110
|
-
fg=typer.colors.RED,
|
|
111
|
-
bold=True,
|
|
112
|
-
)
|
|
113
|
-
raise typer.Exit(code=1)
|
|
114
|
-
|
|
115
|
-
# Validate the federation exists in the configuration
|
|
116
|
-
federation_config = config["tool"]["flwr"]["federations"].get(federation)
|
|
117
|
-
if federation_config is None:
|
|
118
|
-
available_feds = {
|
|
119
|
-
fed for fed in config["tool"]["flwr"]["federations"] if fed != "default"
|
|
120
|
-
}
|
|
121
|
-
typer.secho(
|
|
122
|
-
f"❌ There is no `{federation}` federation declared in "
|
|
123
|
-
"`pyproject.toml`.\n The following federations were found:\n\n"
|
|
124
|
-
+ "\n".join(available_feds),
|
|
125
|
-
fg=typer.colors.RED,
|
|
126
|
-
bold=True,
|
|
127
|
-
)
|
|
128
|
-
raise typer.Exit(code=1)
|
|
86
|
+
config = validate_project_config(config, errors, warnings)
|
|
87
|
+
federation, federation_config = validate_federation_in_project_config(
|
|
88
|
+
federation, config
|
|
89
|
+
)
|
|
129
90
|
|
|
130
91
|
if "address" in federation_config:
|
|
131
|
-
|
|
92
|
+
_run_with_exec_api(app, federation_config, config_overrides, stream)
|
|
132
93
|
else:
|
|
133
|
-
|
|
94
|
+
_run_without_exec_api(app, federation_config, config_overrides, federation)
|
|
134
95
|
|
|
135
96
|
|
|
136
|
-
|
|
137
|
-
def _run_with_superexec(
|
|
97
|
+
def _run_with_exec_api(
|
|
138
98
|
app: Path,
|
|
139
99
|
federation_config: dict[str, Any],
|
|
140
100
|
config_overrides: Optional[list[str]],
|
|
141
101
|
stream: bool,
|
|
142
102
|
) -> None:
|
|
143
103
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if insecure := bool(insecure_str):
|
|
148
|
-
typer.secho(
|
|
149
|
-
"❌ `root_certificates` were provided but the `insecure` parameter"
|
|
150
|
-
"is set to `True`.",
|
|
151
|
-
fg=typer.colors.RED,
|
|
152
|
-
bold=True,
|
|
153
|
-
)
|
|
154
|
-
raise typer.Exit(code=1)
|
|
155
|
-
else:
|
|
156
|
-
root_certificates_bytes = None
|
|
157
|
-
if insecure_str is None:
|
|
158
|
-
typer.secho(
|
|
159
|
-
"❌ To disable TLS, set `insecure = true` in `pyproject.toml`.",
|
|
160
|
-
fg=typer.colors.RED,
|
|
161
|
-
bold=True,
|
|
162
|
-
)
|
|
163
|
-
raise typer.Exit(code=1)
|
|
164
|
-
if not (insecure := bool(insecure_str)):
|
|
165
|
-
typer.secho(
|
|
166
|
-
"❌ No certificate were given yet `insecure` is set to `False`.",
|
|
167
|
-
fg=typer.colors.RED,
|
|
168
|
-
bold=True,
|
|
169
|
-
)
|
|
170
|
-
raise typer.Exit(code=1)
|
|
171
|
-
|
|
104
|
+
insecure, root_certificates_bytes = validate_certificate_in_federation_config(
|
|
105
|
+
app, federation_config
|
|
106
|
+
)
|
|
172
107
|
channel = create_channel(
|
|
173
108
|
server_address=federation_config["address"],
|
|
174
109
|
insecure=insecure,
|
|
@@ -192,7 +127,7 @@ def _run_with_superexec(
|
|
|
192
127
|
)
|
|
193
128
|
res = stub.StartRun(req)
|
|
194
129
|
|
|
195
|
-
# Delete FAB file once it has been sent to the
|
|
130
|
+
# Delete FAB file once it has been sent to the Exec API
|
|
196
131
|
Path(fab_path).unlink()
|
|
197
132
|
typer.secho(f"🎊 Successfully started run {res.run_id}", fg=typer.colors.GREEN)
|
|
198
133
|
|
|
@@ -200,7 +135,7 @@ def _run_with_superexec(
|
|
|
200
135
|
start_stream(res.run_id, channel, CONN_REFRESH_PERIOD)
|
|
201
136
|
|
|
202
137
|
|
|
203
|
-
def
|
|
138
|
+
def _run_without_exec_api(
|
|
204
139
|
app: Optional[Path],
|
|
205
140
|
federation_config: dict[str, Any],
|
|
206
141
|
config_overrides: Optional[list[str]],
|
flwr/client/clientapp/app.py
CHANGED
|
@@ -54,8 +54,6 @@ from .utils import get_load_client_app_fn
|
|
|
54
54
|
|
|
55
55
|
def flwr_clientapp() -> None:
|
|
56
56
|
"""Run process-isolated Flower ClientApp."""
|
|
57
|
-
log(INFO, "Starting Flower ClientApp")
|
|
58
|
-
|
|
59
57
|
parser = argparse.ArgumentParser(
|
|
60
58
|
description="Run a Flower ClientApp",
|
|
61
59
|
)
|
|
@@ -72,6 +70,7 @@ def flwr_clientapp() -> None:
|
|
|
72
70
|
)
|
|
73
71
|
args = parser.parse_args()
|
|
74
72
|
|
|
73
|
+
log(INFO, "Starting Flower ClientApp")
|
|
75
74
|
log(
|
|
76
75
|
DEBUG,
|
|
77
76
|
"Staring isolated `ClientApp` connected to SuperNode ClientAppIo at %s "
|
flwr/common/constant.py
CHANGED
|
@@ -41,7 +41,7 @@ TRANSPORT_TYPES = [
|
|
|
41
41
|
# SuperNode
|
|
42
42
|
CLIENTAPPIO_API_DEFAULT_ADDRESS = "0.0.0.0:9094"
|
|
43
43
|
# SuperLink
|
|
44
|
-
|
|
44
|
+
SERVERAPPIO_API_DEFAULT_ADDRESS = "0.0.0.0:9091"
|
|
45
45
|
FLEET_API_GRPC_RERE_DEFAULT_ADDRESS = "0.0.0.0:9092"
|
|
46
46
|
FLEET_API_GRPC_BIDI_DEFAULT_ADDRESS = (
|
|
47
47
|
"[::]:8080" # IPv6 to keep start_server compatible
|
flwr/common/logger.py
CHANGED
|
@@ -26,9 +26,9 @@ from typing import TYPE_CHECKING, Any, Optional, TextIO
|
|
|
26
26
|
|
|
27
27
|
import grpc
|
|
28
28
|
|
|
29
|
-
from flwr.proto.driver_pb2_grpc import DriverStub # pylint: disable=E0611
|
|
30
29
|
from flwr.proto.log_pb2 import PushLogsRequest # pylint: disable=E0611
|
|
31
30
|
from flwr.proto.node_pb2 import Node # pylint: disable=E0611
|
|
31
|
+
from flwr.proto.serverappio_pb2_grpc import ServerAppIoStub # pylint: disable=E0611
|
|
32
32
|
|
|
33
33
|
from .constant import LOG_UPLOAD_INTERVAL
|
|
34
34
|
|
|
@@ -303,7 +303,7 @@ def restore_output() -> None:
|
|
|
303
303
|
|
|
304
304
|
|
|
305
305
|
def _log_uploader(
|
|
306
|
-
log_queue: Queue[Optional[str]], node_id: int, run_id: int, stub:
|
|
306
|
+
log_queue: Queue[Optional[str]], node_id: int, run_id: int, stub: ServerAppIoStub
|
|
307
307
|
) -> None:
|
|
308
308
|
"""Upload logs to the SuperLink."""
|
|
309
309
|
exit_flag = False
|
|
@@ -346,7 +346,7 @@ def _log_uploader(
|
|
|
346
346
|
|
|
347
347
|
|
|
348
348
|
def start_log_uploader(
|
|
349
|
-
log_queue: Queue[Optional[str]], node_id: int, run_id: int, stub:
|
|
349
|
+
log_queue: Queue[Optional[str]], node_id: int, run_id: int, stub: ServerAppIoStub
|
|
350
350
|
) -> threading.Thread:
|
|
351
351
|
"""Start the log uploader thread and return it."""
|
|
352
352
|
thread = threading.Thread(
|
flwr/common/telemetry.py
CHANGED
|
@@ -150,12 +150,6 @@ class EventType(str, Enum):
|
|
|
150
150
|
|
|
151
151
|
# Not yet implemented
|
|
152
152
|
|
|
153
|
-
# --- SuperExec --------------------------------------------------------------------
|
|
154
|
-
|
|
155
|
-
# SuperExec
|
|
156
|
-
RUN_SUPEREXEC_ENTER = auto()
|
|
157
|
-
RUN_SUPEREXEC_LEAVE = auto()
|
|
158
|
-
|
|
159
153
|
# --- Simulation Engine ------------------------------------------------------------
|
|
160
154
|
|
|
161
155
|
# CLI: flower-simulation
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: flwr/proto/serverappio.proto
|
|
4
|
+
# Protobuf Python Version: 4.25.0
|
|
5
|
+
"""Generated protocol buffer code."""
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
from google.protobuf.internal import builder as _builder
|
|
10
|
+
# @@protoc_insertion_point(imports)
|
|
11
|
+
|
|
12
|
+
_sym_db = _symbol_database.Default()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from flwr.proto import log_pb2 as flwr_dot_proto_dot_log__pb2
|
|
16
|
+
from flwr.proto import node_pb2 as flwr_dot_proto_dot_node__pb2
|
|
17
|
+
from flwr.proto import message_pb2 as flwr_dot_proto_dot_message__pb2
|
|
18
|
+
from flwr.proto import task_pb2 as flwr_dot_proto_dot_task__pb2
|
|
19
|
+
from flwr.proto import run_pb2 as flwr_dot_proto_dot_run__pb2
|
|
20
|
+
from flwr.proto import fab_pb2 as flwr_dot_proto_dot_fab__pb2
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1c\x66lwr/proto/serverappio.proto\x12\nflwr.proto\x1a\x14\x66lwr/proto/log.proto\x1a\x15\x66lwr/proto/node.proto\x1a\x18\x66lwr/proto/message.proto\x1a\x15\x66lwr/proto/task.proto\x1a\x14\x66lwr/proto/run.proto\x1a\x14\x66lwr/proto/fab.proto\"!\n\x0fGetNodesRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\"3\n\x10GetNodesResponse\x12\x1f\n\x05nodes\x18\x01 \x03(\x0b\x32\x10.flwr.proto.Node\"@\n\x12PushTaskInsRequest\x12*\n\rtask_ins_list\x18\x01 \x03(\x0b\x32\x13.flwr.proto.TaskIns\"\'\n\x13PushTaskInsResponse\x12\x10\n\x08task_ids\x18\x02 \x03(\t\"F\n\x12PullTaskResRequest\x12\x1e\n\x04node\x18\x01 \x01(\x0b\x32\x10.flwr.proto.Node\x12\x10\n\x08task_ids\x18\x02 \x03(\t\"A\n\x13PullTaskResResponse\x12*\n\rtask_res_list\x18\x01 \x03(\x0b\x32\x13.flwr.proto.TaskRes\"\x1c\n\x1aPullServerAppInputsRequest\"\x7f\n\x1bPullServerAppInputsResponse\x12$\n\x07\x63ontext\x18\x01 \x01(\x0b\x32\x13.flwr.proto.Context\x12\x1c\n\x03run\x18\x02 \x01(\x0b\x32\x0f.flwr.proto.Run\x12\x1c\n\x03\x66\x61\x62\x18\x03 \x01(\x0b\x32\x0f.flwr.proto.Fab\"S\n\x1bPushServerAppOutputsRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\x12$\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x13.flwr.proto.Context\"\x1e\n\x1cPushServerAppOutputsResponse2\xca\x06\n\x0bServerAppIo\x12J\n\tCreateRun\x12\x1c.flwr.proto.CreateRunRequest\x1a\x1d.flwr.proto.CreateRunResponse\"\x00\x12G\n\x08GetNodes\x12\x1b.flwr.proto.GetNodesRequest\x1a\x1c.flwr.proto.GetNodesResponse\"\x00\x12P\n\x0bPushTaskIns\x12\x1e.flwr.proto.PushTaskInsRequest\x1a\x1f.flwr.proto.PushTaskInsResponse\"\x00\x12P\n\x0bPullTaskRes\x12\x1e.flwr.proto.PullTaskResRequest\x1a\x1f.flwr.proto.PullTaskResResponse\"\x00\x12\x41\n\x06GetRun\x12\x19.flwr.proto.GetRunRequest\x1a\x1a.flwr.proto.GetRunResponse\"\x00\x12\x41\n\x06GetFab\x12\x19.flwr.proto.GetFabRequest\x1a\x1a.flwr.proto.GetFabResponse\"\x00\x12h\n\x13PullServerAppInputs\x12&.flwr.proto.PullServerAppInputsRequest\x1a\'.flwr.proto.PullServerAppInputsResponse\"\x00\x12k\n\x14PushServerAppOutputs\x12\'.flwr.proto.PushServerAppOutputsRequest\x1a(.flwr.proto.PushServerAppOutputsResponse\"\x00\x12\\\n\x0fUpdateRunStatus\x12\".flwr.proto.UpdateRunStatusRequest\x1a#.flwr.proto.UpdateRunStatusResponse\"\x00\x12G\n\x08PushLogs\x12\x1b.flwr.proto.PushLogsRequest\x1a\x1c.flwr.proto.PushLogsResponse\"\x00\x62\x06proto3')
|
|
24
|
+
|
|
25
|
+
_globals = globals()
|
|
26
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
27
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'flwr.proto.serverappio_pb2', _globals)
|
|
28
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
29
|
+
DESCRIPTOR._options = None
|
|
30
|
+
_globals['_GETNODESREQUEST']._serialized_start=182
|
|
31
|
+
_globals['_GETNODESREQUEST']._serialized_end=215
|
|
32
|
+
_globals['_GETNODESRESPONSE']._serialized_start=217
|
|
33
|
+
_globals['_GETNODESRESPONSE']._serialized_end=268
|
|
34
|
+
_globals['_PUSHTASKINSREQUEST']._serialized_start=270
|
|
35
|
+
_globals['_PUSHTASKINSREQUEST']._serialized_end=334
|
|
36
|
+
_globals['_PUSHTASKINSRESPONSE']._serialized_start=336
|
|
37
|
+
_globals['_PUSHTASKINSRESPONSE']._serialized_end=375
|
|
38
|
+
_globals['_PULLTASKRESREQUEST']._serialized_start=377
|
|
39
|
+
_globals['_PULLTASKRESREQUEST']._serialized_end=447
|
|
40
|
+
_globals['_PULLTASKRESRESPONSE']._serialized_start=449
|
|
41
|
+
_globals['_PULLTASKRESRESPONSE']._serialized_end=514
|
|
42
|
+
_globals['_PULLSERVERAPPINPUTSREQUEST']._serialized_start=516
|
|
43
|
+
_globals['_PULLSERVERAPPINPUTSREQUEST']._serialized_end=544
|
|
44
|
+
_globals['_PULLSERVERAPPINPUTSRESPONSE']._serialized_start=546
|
|
45
|
+
_globals['_PULLSERVERAPPINPUTSRESPONSE']._serialized_end=673
|
|
46
|
+
_globals['_PUSHSERVERAPPOUTPUTSREQUEST']._serialized_start=675
|
|
47
|
+
_globals['_PUSHSERVERAPPOUTPUTSREQUEST']._serialized_end=758
|
|
48
|
+
_globals['_PUSHSERVERAPPOUTPUTSRESPONSE']._serialized_start=760
|
|
49
|
+
_globals['_PUSHSERVERAPPOUTPUTSRESPONSE']._serialized_end=790
|
|
50
|
+
_globals['_SERVERAPPIO']._serialized_start=793
|
|
51
|
+
_globals['_SERVERAPPIO']._serialized_end=1635
|
|
52
|
+
# @@protoc_insertion_point(module_scope)
|