flwr-nightly 1.13.0.dev20241031__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.dev20241031.dist-info → flwr_nightly-1.13.0.dev20241102.dist-info}/METADATA +1 -1
- {flwr_nightly-1.13.0.dev20241031.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.dev20241031.dist-info → flwr_nightly-1.13.0.dev20241102.dist-info}/LICENSE +0 -0
- {flwr_nightly-1.13.0.dev20241031.dist-info → flwr_nightly-1.13.0.dev20241102.dist-info}/WHEEL +0 -0
- {flwr_nightly-1.13.0.dev20241031.dist-info → flwr_nightly-1.13.0.dev20241102.dist-info}/entry_points.txt +0 -0
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
3
|
import grpc
|
|
4
4
|
|
|
5
|
-
from flwr.proto import driver_pb2 as flwr_dot_proto_dot_driver__pb2
|
|
6
5
|
from flwr.proto import fab_pb2 as flwr_dot_proto_dot_fab__pb2
|
|
7
6
|
from flwr.proto import log_pb2 as flwr_dot_proto_dot_log__pb2
|
|
8
7
|
from flwr.proto import run_pb2 as flwr_dot_proto_dot_run__pb2
|
|
8
|
+
from flwr.proto import serverappio_pb2 as flwr_dot_proto_dot_serverappio__pb2
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class
|
|
11
|
+
class ServerAppIoStub(object):
|
|
12
12
|
"""Missing associated documentation comment in .proto file."""
|
|
13
13
|
|
|
14
14
|
def __init__(self, channel):
|
|
@@ -18,58 +18,58 @@ class DriverStub(object):
|
|
|
18
18
|
channel: A grpc.Channel.
|
|
19
19
|
"""
|
|
20
20
|
self.CreateRun = channel.unary_unary(
|
|
21
|
-
'/flwr.proto.
|
|
21
|
+
'/flwr.proto.ServerAppIo/CreateRun',
|
|
22
22
|
request_serializer=flwr_dot_proto_dot_run__pb2.CreateRunRequest.SerializeToString,
|
|
23
23
|
response_deserializer=flwr_dot_proto_dot_run__pb2.CreateRunResponse.FromString,
|
|
24
24
|
)
|
|
25
25
|
self.GetNodes = channel.unary_unary(
|
|
26
|
-
'/flwr.proto.
|
|
27
|
-
request_serializer=
|
|
28
|
-
response_deserializer=
|
|
26
|
+
'/flwr.proto.ServerAppIo/GetNodes',
|
|
27
|
+
request_serializer=flwr_dot_proto_dot_serverappio__pb2.GetNodesRequest.SerializeToString,
|
|
28
|
+
response_deserializer=flwr_dot_proto_dot_serverappio__pb2.GetNodesResponse.FromString,
|
|
29
29
|
)
|
|
30
30
|
self.PushTaskIns = channel.unary_unary(
|
|
31
|
-
'/flwr.proto.
|
|
32
|
-
request_serializer=
|
|
33
|
-
response_deserializer=
|
|
31
|
+
'/flwr.proto.ServerAppIo/PushTaskIns',
|
|
32
|
+
request_serializer=flwr_dot_proto_dot_serverappio__pb2.PushTaskInsRequest.SerializeToString,
|
|
33
|
+
response_deserializer=flwr_dot_proto_dot_serverappio__pb2.PushTaskInsResponse.FromString,
|
|
34
34
|
)
|
|
35
35
|
self.PullTaskRes = channel.unary_unary(
|
|
36
|
-
'/flwr.proto.
|
|
37
|
-
request_serializer=
|
|
38
|
-
response_deserializer=
|
|
36
|
+
'/flwr.proto.ServerAppIo/PullTaskRes',
|
|
37
|
+
request_serializer=flwr_dot_proto_dot_serverappio__pb2.PullTaskResRequest.SerializeToString,
|
|
38
|
+
response_deserializer=flwr_dot_proto_dot_serverappio__pb2.PullTaskResResponse.FromString,
|
|
39
39
|
)
|
|
40
40
|
self.GetRun = channel.unary_unary(
|
|
41
|
-
'/flwr.proto.
|
|
41
|
+
'/flwr.proto.ServerAppIo/GetRun',
|
|
42
42
|
request_serializer=flwr_dot_proto_dot_run__pb2.GetRunRequest.SerializeToString,
|
|
43
43
|
response_deserializer=flwr_dot_proto_dot_run__pb2.GetRunResponse.FromString,
|
|
44
44
|
)
|
|
45
45
|
self.GetFab = channel.unary_unary(
|
|
46
|
-
'/flwr.proto.
|
|
46
|
+
'/flwr.proto.ServerAppIo/GetFab',
|
|
47
47
|
request_serializer=flwr_dot_proto_dot_fab__pb2.GetFabRequest.SerializeToString,
|
|
48
48
|
response_deserializer=flwr_dot_proto_dot_fab__pb2.GetFabResponse.FromString,
|
|
49
49
|
)
|
|
50
50
|
self.PullServerAppInputs = channel.unary_unary(
|
|
51
|
-
'/flwr.proto.
|
|
52
|
-
request_serializer=
|
|
53
|
-
response_deserializer=
|
|
51
|
+
'/flwr.proto.ServerAppIo/PullServerAppInputs',
|
|
52
|
+
request_serializer=flwr_dot_proto_dot_serverappio__pb2.PullServerAppInputsRequest.SerializeToString,
|
|
53
|
+
response_deserializer=flwr_dot_proto_dot_serverappio__pb2.PullServerAppInputsResponse.FromString,
|
|
54
54
|
)
|
|
55
55
|
self.PushServerAppOutputs = channel.unary_unary(
|
|
56
|
-
'/flwr.proto.
|
|
57
|
-
request_serializer=
|
|
58
|
-
response_deserializer=
|
|
56
|
+
'/flwr.proto.ServerAppIo/PushServerAppOutputs',
|
|
57
|
+
request_serializer=flwr_dot_proto_dot_serverappio__pb2.PushServerAppOutputsRequest.SerializeToString,
|
|
58
|
+
response_deserializer=flwr_dot_proto_dot_serverappio__pb2.PushServerAppOutputsResponse.FromString,
|
|
59
59
|
)
|
|
60
60
|
self.UpdateRunStatus = channel.unary_unary(
|
|
61
|
-
'/flwr.proto.
|
|
61
|
+
'/flwr.proto.ServerAppIo/UpdateRunStatus',
|
|
62
62
|
request_serializer=flwr_dot_proto_dot_run__pb2.UpdateRunStatusRequest.SerializeToString,
|
|
63
63
|
response_deserializer=flwr_dot_proto_dot_run__pb2.UpdateRunStatusResponse.FromString,
|
|
64
64
|
)
|
|
65
65
|
self.PushLogs = channel.unary_unary(
|
|
66
|
-
'/flwr.proto.
|
|
66
|
+
'/flwr.proto.ServerAppIo/PushLogs',
|
|
67
67
|
request_serializer=flwr_dot_proto_dot_log__pb2.PushLogsRequest.SerializeToString,
|
|
68
68
|
response_deserializer=flwr_dot_proto_dot_log__pb2.PushLogsResponse.FromString,
|
|
69
69
|
)
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
class
|
|
72
|
+
class ServerAppIoServicer(object):
|
|
73
73
|
"""Missing associated documentation comment in .proto file."""
|
|
74
74
|
|
|
75
75
|
def CreateRun(self, request, context):
|
|
@@ -143,7 +143,7 @@ class DriverServicer(object):
|
|
|
143
143
|
raise NotImplementedError('Method not implemented!')
|
|
144
144
|
|
|
145
145
|
|
|
146
|
-
def
|
|
146
|
+
def add_ServerAppIoServicer_to_server(servicer, server):
|
|
147
147
|
rpc_method_handlers = {
|
|
148
148
|
'CreateRun': grpc.unary_unary_rpc_method_handler(
|
|
149
149
|
servicer.CreateRun,
|
|
@@ -152,18 +152,18 @@ def add_DriverServicer_to_server(servicer, server):
|
|
|
152
152
|
),
|
|
153
153
|
'GetNodes': grpc.unary_unary_rpc_method_handler(
|
|
154
154
|
servicer.GetNodes,
|
|
155
|
-
request_deserializer=
|
|
156
|
-
response_serializer=
|
|
155
|
+
request_deserializer=flwr_dot_proto_dot_serverappio__pb2.GetNodesRequest.FromString,
|
|
156
|
+
response_serializer=flwr_dot_proto_dot_serverappio__pb2.GetNodesResponse.SerializeToString,
|
|
157
157
|
),
|
|
158
158
|
'PushTaskIns': grpc.unary_unary_rpc_method_handler(
|
|
159
159
|
servicer.PushTaskIns,
|
|
160
|
-
request_deserializer=
|
|
161
|
-
response_serializer=
|
|
160
|
+
request_deserializer=flwr_dot_proto_dot_serverappio__pb2.PushTaskInsRequest.FromString,
|
|
161
|
+
response_serializer=flwr_dot_proto_dot_serverappio__pb2.PushTaskInsResponse.SerializeToString,
|
|
162
162
|
),
|
|
163
163
|
'PullTaskRes': grpc.unary_unary_rpc_method_handler(
|
|
164
164
|
servicer.PullTaskRes,
|
|
165
|
-
request_deserializer=
|
|
166
|
-
response_serializer=
|
|
165
|
+
request_deserializer=flwr_dot_proto_dot_serverappio__pb2.PullTaskResRequest.FromString,
|
|
166
|
+
response_serializer=flwr_dot_proto_dot_serverappio__pb2.PullTaskResResponse.SerializeToString,
|
|
167
167
|
),
|
|
168
168
|
'GetRun': grpc.unary_unary_rpc_method_handler(
|
|
169
169
|
servicer.GetRun,
|
|
@@ -177,13 +177,13 @@ def add_DriverServicer_to_server(servicer, server):
|
|
|
177
177
|
),
|
|
178
178
|
'PullServerAppInputs': grpc.unary_unary_rpc_method_handler(
|
|
179
179
|
servicer.PullServerAppInputs,
|
|
180
|
-
request_deserializer=
|
|
181
|
-
response_serializer=
|
|
180
|
+
request_deserializer=flwr_dot_proto_dot_serverappio__pb2.PullServerAppInputsRequest.FromString,
|
|
181
|
+
response_serializer=flwr_dot_proto_dot_serverappio__pb2.PullServerAppInputsResponse.SerializeToString,
|
|
182
182
|
),
|
|
183
183
|
'PushServerAppOutputs': grpc.unary_unary_rpc_method_handler(
|
|
184
184
|
servicer.PushServerAppOutputs,
|
|
185
|
-
request_deserializer=
|
|
186
|
-
response_serializer=
|
|
185
|
+
request_deserializer=flwr_dot_proto_dot_serverappio__pb2.PushServerAppOutputsRequest.FromString,
|
|
186
|
+
response_serializer=flwr_dot_proto_dot_serverappio__pb2.PushServerAppOutputsResponse.SerializeToString,
|
|
187
187
|
),
|
|
188
188
|
'UpdateRunStatus': grpc.unary_unary_rpc_method_handler(
|
|
189
189
|
servicer.UpdateRunStatus,
|
|
@@ -197,12 +197,12 @@ def add_DriverServicer_to_server(servicer, server):
|
|
|
197
197
|
),
|
|
198
198
|
}
|
|
199
199
|
generic_handler = grpc.method_handlers_generic_handler(
|
|
200
|
-
'flwr.proto.
|
|
200
|
+
'flwr.proto.ServerAppIo', rpc_method_handlers)
|
|
201
201
|
server.add_generic_rpc_handlers((generic_handler,))
|
|
202
202
|
|
|
203
203
|
|
|
204
204
|
# This class is part of an EXPERIMENTAL API.
|
|
205
|
-
class
|
|
205
|
+
class ServerAppIo(object):
|
|
206
206
|
"""Missing associated documentation comment in .proto file."""
|
|
207
207
|
|
|
208
208
|
@staticmethod
|
|
@@ -216,7 +216,7 @@ class Driver(object):
|
|
|
216
216
|
wait_for_ready=None,
|
|
217
217
|
timeout=None,
|
|
218
218
|
metadata=None):
|
|
219
|
-
return grpc.experimental.unary_unary(request, target, '/flwr.proto.
|
|
219
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ServerAppIo/CreateRun',
|
|
220
220
|
flwr_dot_proto_dot_run__pb2.CreateRunRequest.SerializeToString,
|
|
221
221
|
flwr_dot_proto_dot_run__pb2.CreateRunResponse.FromString,
|
|
222
222
|
options, channel_credentials,
|
|
@@ -233,9 +233,9 @@ class Driver(object):
|
|
|
233
233
|
wait_for_ready=None,
|
|
234
234
|
timeout=None,
|
|
235
235
|
metadata=None):
|
|
236
|
-
return grpc.experimental.unary_unary(request, target, '/flwr.proto.
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ServerAppIo/GetNodes',
|
|
237
|
+
flwr_dot_proto_dot_serverappio__pb2.GetNodesRequest.SerializeToString,
|
|
238
|
+
flwr_dot_proto_dot_serverappio__pb2.GetNodesResponse.FromString,
|
|
239
239
|
options, channel_credentials,
|
|
240
240
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
241
241
|
|
|
@@ -250,9 +250,9 @@ class Driver(object):
|
|
|
250
250
|
wait_for_ready=None,
|
|
251
251
|
timeout=None,
|
|
252
252
|
metadata=None):
|
|
253
|
-
return grpc.experimental.unary_unary(request, target, '/flwr.proto.
|
|
254
|
-
|
|
255
|
-
|
|
253
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ServerAppIo/PushTaskIns',
|
|
254
|
+
flwr_dot_proto_dot_serverappio__pb2.PushTaskInsRequest.SerializeToString,
|
|
255
|
+
flwr_dot_proto_dot_serverappio__pb2.PushTaskInsResponse.FromString,
|
|
256
256
|
options, channel_credentials,
|
|
257
257
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
258
258
|
|
|
@@ -267,9 +267,9 @@ class Driver(object):
|
|
|
267
267
|
wait_for_ready=None,
|
|
268
268
|
timeout=None,
|
|
269
269
|
metadata=None):
|
|
270
|
-
return grpc.experimental.unary_unary(request, target, '/flwr.proto.
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ServerAppIo/PullTaskRes',
|
|
271
|
+
flwr_dot_proto_dot_serverappio__pb2.PullTaskResRequest.SerializeToString,
|
|
272
|
+
flwr_dot_proto_dot_serverappio__pb2.PullTaskResResponse.FromString,
|
|
273
273
|
options, channel_credentials,
|
|
274
274
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
275
275
|
|
|
@@ -284,7 +284,7 @@ class Driver(object):
|
|
|
284
284
|
wait_for_ready=None,
|
|
285
285
|
timeout=None,
|
|
286
286
|
metadata=None):
|
|
287
|
-
return grpc.experimental.unary_unary(request, target, '/flwr.proto.
|
|
287
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ServerAppIo/GetRun',
|
|
288
288
|
flwr_dot_proto_dot_run__pb2.GetRunRequest.SerializeToString,
|
|
289
289
|
flwr_dot_proto_dot_run__pb2.GetRunResponse.FromString,
|
|
290
290
|
options, channel_credentials,
|
|
@@ -301,7 +301,7 @@ class Driver(object):
|
|
|
301
301
|
wait_for_ready=None,
|
|
302
302
|
timeout=None,
|
|
303
303
|
metadata=None):
|
|
304
|
-
return grpc.experimental.unary_unary(request, target, '/flwr.proto.
|
|
304
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ServerAppIo/GetFab',
|
|
305
305
|
flwr_dot_proto_dot_fab__pb2.GetFabRequest.SerializeToString,
|
|
306
306
|
flwr_dot_proto_dot_fab__pb2.GetFabResponse.FromString,
|
|
307
307
|
options, channel_credentials,
|
|
@@ -318,9 +318,9 @@ class Driver(object):
|
|
|
318
318
|
wait_for_ready=None,
|
|
319
319
|
timeout=None,
|
|
320
320
|
metadata=None):
|
|
321
|
-
return grpc.experimental.unary_unary(request, target, '/flwr.proto.
|
|
322
|
-
|
|
323
|
-
|
|
321
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ServerAppIo/PullServerAppInputs',
|
|
322
|
+
flwr_dot_proto_dot_serverappio__pb2.PullServerAppInputsRequest.SerializeToString,
|
|
323
|
+
flwr_dot_proto_dot_serverappio__pb2.PullServerAppInputsResponse.FromString,
|
|
324
324
|
options, channel_credentials,
|
|
325
325
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
326
326
|
|
|
@@ -335,9 +335,9 @@ class Driver(object):
|
|
|
335
335
|
wait_for_ready=None,
|
|
336
336
|
timeout=None,
|
|
337
337
|
metadata=None):
|
|
338
|
-
return grpc.experimental.unary_unary(request, target, '/flwr.proto.
|
|
339
|
-
|
|
340
|
-
|
|
338
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ServerAppIo/PushServerAppOutputs',
|
|
339
|
+
flwr_dot_proto_dot_serverappio__pb2.PushServerAppOutputsRequest.SerializeToString,
|
|
340
|
+
flwr_dot_proto_dot_serverappio__pb2.PushServerAppOutputsResponse.FromString,
|
|
341
341
|
options, channel_credentials,
|
|
342
342
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
343
343
|
|
|
@@ -352,7 +352,7 @@ class Driver(object):
|
|
|
352
352
|
wait_for_ready=None,
|
|
353
353
|
timeout=None,
|
|
354
354
|
metadata=None):
|
|
355
|
-
return grpc.experimental.unary_unary(request, target, '/flwr.proto.
|
|
355
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ServerAppIo/UpdateRunStatus',
|
|
356
356
|
flwr_dot_proto_dot_run__pb2.UpdateRunStatusRequest.SerializeToString,
|
|
357
357
|
flwr_dot_proto_dot_run__pb2.UpdateRunStatusResponse.FromString,
|
|
358
358
|
options, channel_credentials,
|
|
@@ -369,7 +369,7 @@ class Driver(object):
|
|
|
369
369
|
wait_for_ready=None,
|
|
370
370
|
timeout=None,
|
|
371
371
|
metadata=None):
|
|
372
|
-
return grpc.experimental.unary_unary(request, target, '/flwr.proto.
|
|
372
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ServerAppIo/PushLogs',
|
|
373
373
|
flwr_dot_proto_dot_log__pb2.PushLogsRequest.SerializeToString,
|
|
374
374
|
flwr_dot_proto_dot_log__pb2.PushLogsResponse.FromString,
|
|
375
375
|
options, channel_credentials,
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
isort:skip_file
|
|
4
4
|
"""
|
|
5
5
|
import abc
|
|
6
|
-
import flwr.proto.driver_pb2
|
|
7
6
|
import flwr.proto.fab_pb2
|
|
8
7
|
import flwr.proto.log_pb2
|
|
9
8
|
import flwr.proto.run_pb2
|
|
9
|
+
import flwr.proto.serverappio_pb2
|
|
10
10
|
import grpc
|
|
11
11
|
|
|
12
|
-
class
|
|
12
|
+
class ServerAppIoStub:
|
|
13
13
|
def __init__(self, channel: grpc.Channel) -> None: ...
|
|
14
14
|
CreateRun: grpc.UnaryUnaryMultiCallable[
|
|
15
15
|
flwr.proto.run_pb2.CreateRunRequest,
|
|
@@ -17,18 +17,18 @@ class DriverStub:
|
|
|
17
17
|
"""Request run_id"""
|
|
18
18
|
|
|
19
19
|
GetNodes: grpc.UnaryUnaryMultiCallable[
|
|
20
|
-
flwr.proto.
|
|
21
|
-
flwr.proto.
|
|
20
|
+
flwr.proto.serverappio_pb2.GetNodesRequest,
|
|
21
|
+
flwr.proto.serverappio_pb2.GetNodesResponse]
|
|
22
22
|
"""Return a set of nodes"""
|
|
23
23
|
|
|
24
24
|
PushTaskIns: grpc.UnaryUnaryMultiCallable[
|
|
25
|
-
flwr.proto.
|
|
26
|
-
flwr.proto.
|
|
25
|
+
flwr.proto.serverappio_pb2.PushTaskInsRequest,
|
|
26
|
+
flwr.proto.serverappio_pb2.PushTaskInsResponse]
|
|
27
27
|
"""Create one or more tasks"""
|
|
28
28
|
|
|
29
29
|
PullTaskRes: grpc.UnaryUnaryMultiCallable[
|
|
30
|
-
flwr.proto.
|
|
31
|
-
flwr.proto.
|
|
30
|
+
flwr.proto.serverappio_pb2.PullTaskResRequest,
|
|
31
|
+
flwr.proto.serverappio_pb2.PullTaskResResponse]
|
|
32
32
|
"""Get task results"""
|
|
33
33
|
|
|
34
34
|
GetRun: grpc.UnaryUnaryMultiCallable[
|
|
@@ -42,13 +42,13 @@ class DriverStub:
|
|
|
42
42
|
"""Get FAB"""
|
|
43
43
|
|
|
44
44
|
PullServerAppInputs: grpc.UnaryUnaryMultiCallable[
|
|
45
|
-
flwr.proto.
|
|
46
|
-
flwr.proto.
|
|
45
|
+
flwr.proto.serverappio_pb2.PullServerAppInputsRequest,
|
|
46
|
+
flwr.proto.serverappio_pb2.PullServerAppInputsResponse]
|
|
47
47
|
"""Pull ServerApp inputs"""
|
|
48
48
|
|
|
49
49
|
PushServerAppOutputs: grpc.UnaryUnaryMultiCallable[
|
|
50
|
-
flwr.proto.
|
|
51
|
-
flwr.proto.
|
|
50
|
+
flwr.proto.serverappio_pb2.PushServerAppOutputsRequest,
|
|
51
|
+
flwr.proto.serverappio_pb2.PushServerAppOutputsResponse]
|
|
52
52
|
"""Push ServerApp outputs"""
|
|
53
53
|
|
|
54
54
|
UpdateRunStatus: grpc.UnaryUnaryMultiCallable[
|
|
@@ -62,7 +62,7 @@ class DriverStub:
|
|
|
62
62
|
"""Push ServerApp logs"""
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
class
|
|
65
|
+
class ServerAppIoServicer(metaclass=abc.ABCMeta):
|
|
66
66
|
@abc.abstractmethod
|
|
67
67
|
def CreateRun(self,
|
|
68
68
|
request: flwr.proto.run_pb2.CreateRunRequest,
|
|
@@ -73,25 +73,25 @@ class DriverServicer(metaclass=abc.ABCMeta):
|
|
|
73
73
|
|
|
74
74
|
@abc.abstractmethod
|
|
75
75
|
def GetNodes(self,
|
|
76
|
-
request: flwr.proto.
|
|
76
|
+
request: flwr.proto.serverappio_pb2.GetNodesRequest,
|
|
77
77
|
context: grpc.ServicerContext,
|
|
78
|
-
) -> flwr.proto.
|
|
78
|
+
) -> flwr.proto.serverappio_pb2.GetNodesResponse:
|
|
79
79
|
"""Return a set of nodes"""
|
|
80
80
|
pass
|
|
81
81
|
|
|
82
82
|
@abc.abstractmethod
|
|
83
83
|
def PushTaskIns(self,
|
|
84
|
-
request: flwr.proto.
|
|
84
|
+
request: flwr.proto.serverappio_pb2.PushTaskInsRequest,
|
|
85
85
|
context: grpc.ServicerContext,
|
|
86
|
-
) -> flwr.proto.
|
|
86
|
+
) -> flwr.proto.serverappio_pb2.PushTaskInsResponse:
|
|
87
87
|
"""Create one or more tasks"""
|
|
88
88
|
pass
|
|
89
89
|
|
|
90
90
|
@abc.abstractmethod
|
|
91
91
|
def PullTaskRes(self,
|
|
92
|
-
request: flwr.proto.
|
|
92
|
+
request: flwr.proto.serverappio_pb2.PullTaskResRequest,
|
|
93
93
|
context: grpc.ServicerContext,
|
|
94
|
-
) -> flwr.proto.
|
|
94
|
+
) -> flwr.proto.serverappio_pb2.PullTaskResResponse:
|
|
95
95
|
"""Get task results"""
|
|
96
96
|
pass
|
|
97
97
|
|
|
@@ -113,17 +113,17 @@ class DriverServicer(metaclass=abc.ABCMeta):
|
|
|
113
113
|
|
|
114
114
|
@abc.abstractmethod
|
|
115
115
|
def PullServerAppInputs(self,
|
|
116
|
-
request: flwr.proto.
|
|
116
|
+
request: flwr.proto.serverappio_pb2.PullServerAppInputsRequest,
|
|
117
117
|
context: grpc.ServicerContext,
|
|
118
|
-
) -> flwr.proto.
|
|
118
|
+
) -> flwr.proto.serverappio_pb2.PullServerAppInputsResponse:
|
|
119
119
|
"""Pull ServerApp inputs"""
|
|
120
120
|
pass
|
|
121
121
|
|
|
122
122
|
@abc.abstractmethod
|
|
123
123
|
def PushServerAppOutputs(self,
|
|
124
|
-
request: flwr.proto.
|
|
124
|
+
request: flwr.proto.serverappio_pb2.PushServerAppOutputsRequest,
|
|
125
125
|
context: grpc.ServicerContext,
|
|
126
|
-
) -> flwr.proto.
|
|
126
|
+
) -> flwr.proto.serverappio_pb2.PushServerAppOutputsResponse:
|
|
127
127
|
"""Push ServerApp outputs"""
|
|
128
128
|
pass
|
|
129
129
|
|
|
@@ -144,4 +144,4 @@ class DriverServicer(metaclass=abc.ABCMeta):
|
|
|
144
144
|
pass
|
|
145
145
|
|
|
146
146
|
|
|
147
|
-
def
|
|
147
|
+
def add_ServerAppIoServicer_to_server(servicer: ServerAppIoServicer, server: grpc.Server) -> None: ...
|
flwr/server/app.py
CHANGED
|
@@ -39,7 +39,6 @@ from flwr.common import GRPC_MAX_MESSAGE_LENGTH, EventType, event
|
|
|
39
39
|
from flwr.common.address import parse_address
|
|
40
40
|
from flwr.common.config import get_flwr_dir, parse_config_args
|
|
41
41
|
from flwr.common.constant import (
|
|
42
|
-
DRIVER_API_DEFAULT_ADDRESS,
|
|
43
42
|
EXEC_API_DEFAULT_ADDRESS,
|
|
44
43
|
FLEET_API_GRPC_BIDI_DEFAULT_ADDRESS,
|
|
45
44
|
FLEET_API_GRPC_RERE_DEFAULT_ADDRESS,
|
|
@@ -47,6 +46,7 @@ from flwr.common.constant import (
|
|
|
47
46
|
ISOLATION_MODE_PROCESS,
|
|
48
47
|
ISOLATION_MODE_SUBPROCESS,
|
|
49
48
|
MISSING_EXTRA_REST,
|
|
49
|
+
SERVERAPPIO_API_DEFAULT_ADDRESS,
|
|
50
50
|
TRANSPORT_TYPE_GRPC_ADAPTER,
|
|
51
51
|
TRANSPORT_TYPE_GRPC_RERE,
|
|
52
52
|
TRANSPORT_TYPE_REST,
|
|
@@ -69,7 +69,7 @@ from .history import History
|
|
|
69
69
|
from .server import Server, init_defaults, run_fl
|
|
70
70
|
from .server_config import ServerConfig
|
|
71
71
|
from .strategy import Strategy
|
|
72
|
-
from .superlink.driver.
|
|
72
|
+
from .superlink.driver.serverappio_grpc import run_serverappio_api_grpc
|
|
73
73
|
from .superlink.ffs.ffs_factory import FfsFactory
|
|
74
74
|
from .superlink.fleet.grpc_adapter.grpc_adapter_servicer import GrpcAdapterServicer
|
|
75
75
|
from .superlink.fleet.grpc_bidi.grpc_server import (
|
|
@@ -205,7 +205,7 @@ def start_server( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
205
205
|
|
|
206
206
|
# pylint: disable=too-many-branches, too-many-locals, too-many-statements
|
|
207
207
|
def run_superlink() -> None:
|
|
208
|
-
"""Run Flower SuperLink (
|
|
208
|
+
"""Run Flower SuperLink (ServerAppIo API and Fleet API)."""
|
|
209
209
|
args = _parse_args_run_superlink().parse_args()
|
|
210
210
|
|
|
211
211
|
log(INFO, "Starting Flower SuperLink")
|
|
@@ -213,7 +213,7 @@ def run_superlink() -> None:
|
|
|
213
213
|
event(EventType.RUN_SUPERLINK_ENTER)
|
|
214
214
|
|
|
215
215
|
# Parse IP addresses
|
|
216
|
-
|
|
216
|
+
serverappio_address, _, _ = _format_address(args.serverappio_api_address)
|
|
217
217
|
exec_address, _, _ = _format_address(args.exec_api_address)
|
|
218
218
|
|
|
219
219
|
# Obtain certificates
|
|
@@ -225,14 +225,14 @@ def run_superlink() -> None:
|
|
|
225
225
|
# Initialize FfsFactory
|
|
226
226
|
ffs_factory = FfsFactory(args.storage_dir)
|
|
227
227
|
|
|
228
|
-
# Start
|
|
229
|
-
|
|
230
|
-
address=
|
|
228
|
+
# Start ServerAppIo API
|
|
229
|
+
serverappio_server: grpc.Server = run_serverappio_api_grpc(
|
|
230
|
+
address=serverappio_address,
|
|
231
231
|
state_factory=state_factory,
|
|
232
232
|
ffs_factory=ffs_factory,
|
|
233
233
|
certificates=certificates,
|
|
234
234
|
)
|
|
235
|
-
grpc_servers = [
|
|
235
|
+
grpc_servers = [serverappio_server]
|
|
236
236
|
|
|
237
237
|
# Start Fleet API
|
|
238
238
|
bckg_threads = []
|
|
@@ -343,7 +343,7 @@ def run_superlink() -> None:
|
|
|
343
343
|
# Scheduler thread
|
|
344
344
|
scheduler_th = threading.Thread(
|
|
345
345
|
target=_flwr_serverapp_scheduler,
|
|
346
|
-
args=(state_factory, args.
|
|
346
|
+
args=(state_factory, args.serverappio_api_address, args.ssl_ca_certfile),
|
|
347
347
|
)
|
|
348
348
|
scheduler_th.start()
|
|
349
349
|
bckg_threads.append(scheduler_th)
|
|
@@ -361,12 +361,12 @@ def run_superlink() -> None:
|
|
|
361
361
|
for thread in bckg_threads:
|
|
362
362
|
if not thread.is_alive():
|
|
363
363
|
sys.exit(1)
|
|
364
|
-
|
|
364
|
+
serverappio_server.wait_for_termination(timeout=1)
|
|
365
365
|
|
|
366
366
|
|
|
367
367
|
def _flwr_serverapp_scheduler(
|
|
368
368
|
state_factory: LinkStateFactory,
|
|
369
|
-
|
|
369
|
+
serverappio_api_address: str,
|
|
370
370
|
ssl_ca_certfile: Optional[str],
|
|
371
371
|
) -> None:
|
|
372
372
|
log(DEBUG, "Started flwr-serverapp scheduler thread.")
|
|
@@ -383,13 +383,13 @@ def _flwr_serverapp_scheduler(
|
|
|
383
383
|
log(
|
|
384
384
|
INFO,
|
|
385
385
|
"Launching `flwr-serverapp` subprocess. Connects to SuperLink on %s",
|
|
386
|
-
|
|
386
|
+
serverappio_api_address,
|
|
387
387
|
)
|
|
388
388
|
# Start ServerApp subprocess
|
|
389
389
|
command = [
|
|
390
390
|
"flwr-serverapp",
|
|
391
391
|
"--superlink",
|
|
392
|
-
|
|
392
|
+
serverappio_api_address,
|
|
393
393
|
]
|
|
394
394
|
if ssl_ca_certfile:
|
|
395
395
|
command.append("--root-certificates")
|
|
@@ -621,7 +621,7 @@ def _run_fleet_api_rest(
|
|
|
621
621
|
ffs_factory: FfsFactory,
|
|
622
622
|
num_workers: int,
|
|
623
623
|
) -> None:
|
|
624
|
-
"""Run
|
|
624
|
+
"""Run ServerAppIo API (REST-based)."""
|
|
625
625
|
try:
|
|
626
626
|
import uvicorn
|
|
627
627
|
|
|
@@ -648,13 +648,13 @@ def _run_fleet_api_rest(
|
|
|
648
648
|
|
|
649
649
|
|
|
650
650
|
def _parse_args_run_superlink() -> argparse.ArgumentParser:
|
|
651
|
-
"""Parse command line arguments for both
|
|
651
|
+
"""Parse command line arguments for both ServerAppIo API and Fleet API."""
|
|
652
652
|
parser = argparse.ArgumentParser(
|
|
653
653
|
description="Start a Flower SuperLink",
|
|
654
654
|
)
|
|
655
655
|
|
|
656
656
|
_add_args_common(parser=parser)
|
|
657
|
-
|
|
657
|
+
_add_args_serverappio_api(parser=parser)
|
|
658
658
|
_add_args_fleet_api(parser=parser)
|
|
659
659
|
_add_args_exec_api(parser=parser)
|
|
660
660
|
|
|
@@ -733,11 +733,11 @@ def _add_args_common(parser: argparse.ArgumentParser) -> None:
|
|
|
733
733
|
)
|
|
734
734
|
|
|
735
735
|
|
|
736
|
-
def
|
|
736
|
+
def _add_args_serverappio_api(parser: argparse.ArgumentParser) -> None:
|
|
737
737
|
parser.add_argument(
|
|
738
|
-
"--
|
|
739
|
-
help="
|
|
740
|
-
default=
|
|
738
|
+
"--serverappio-api-address",
|
|
739
|
+
help="ServerAppIo API (gRPC) server address (IPv4, IPv6, or a domain name).",
|
|
740
|
+
default=SERVERAPPIO_API_DEFAULT_ADDRESS,
|
|
741
741
|
)
|
|
742
742
|
|
|
743
743
|
|
flwr/server/driver/driver.py
CHANGED
|
@@ -23,7 +23,7 @@ from typing import Optional, cast
|
|
|
23
23
|
import grpc
|
|
24
24
|
|
|
25
25
|
from flwr.common import DEFAULT_TTL, Message, Metadata, RecordSet
|
|
26
|
-
from flwr.common.constant import
|
|
26
|
+
from flwr.common.constant import SERVERAPPIO_API_DEFAULT_ADDRESS
|
|
27
27
|
from flwr.common.grpc import create_channel
|
|
28
28
|
from flwr.common.logger import log
|
|
29
29
|
from flwr.common.serde import (
|
|
@@ -32,7 +32,9 @@ from flwr.common.serde import (
|
|
|
32
32
|
user_config_from_proto,
|
|
33
33
|
)
|
|
34
34
|
from flwr.common.typing import Run
|
|
35
|
-
from flwr.proto.
|
|
35
|
+
from flwr.proto.node_pb2 import Node # pylint: disable=E0611
|
|
36
|
+
from flwr.proto.run_pb2 import GetRunRequest, GetRunResponse # pylint: disable=E0611
|
|
37
|
+
from flwr.proto.serverappio_pb2 import ( # pylint: disable=E0611
|
|
36
38
|
GetNodesRequest,
|
|
37
39
|
GetNodesResponse,
|
|
38
40
|
PullTaskResRequest,
|
|
@@ -40,9 +42,7 @@ from flwr.proto.driver_pb2 import ( # pylint: disable=E0611
|
|
|
40
42
|
PushTaskInsRequest,
|
|
41
43
|
PushTaskInsResponse,
|
|
42
44
|
)
|
|
43
|
-
from flwr.proto.
|
|
44
|
-
from flwr.proto.node_pb2 import Node # pylint: disable=E0611
|
|
45
|
-
from flwr.proto.run_pb2 import GetRunRequest, GetRunResponse # pylint: disable=E0611
|
|
45
|
+
from flwr.proto.serverappio_pb2_grpc import ServerAppIoStub # pylint: disable=E0611
|
|
46
46
|
from flwr.proto.task_pb2 import TaskIns # pylint: disable=E0611
|
|
47
47
|
|
|
48
48
|
from .driver import Driver
|
|
@@ -56,12 +56,12 @@ Call `connect()` on the `GrpcDriverStub` instance before calling any of the othe
|
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
class GrpcDriver(Driver):
|
|
59
|
-
"""`GrpcDriver` provides an interface to the
|
|
59
|
+
"""`GrpcDriver` provides an interface to the ServerAppIo API.
|
|
60
60
|
|
|
61
61
|
Parameters
|
|
62
62
|
----------
|
|
63
|
-
|
|
64
|
-
The address (URL, IPv6, IPv4) of the SuperLink
|
|
63
|
+
serverappio_service_address : str (default: "[::]:9091")
|
|
64
|
+
The address (URL, IPv6, IPv4) of the SuperLink ServerAppIo API service.
|
|
65
65
|
root_certificates : Optional[bytes] (default: None)
|
|
66
66
|
The PEM-encoded root certificates as a byte string.
|
|
67
67
|
If provided, a secure connection using the certificates will be
|
|
@@ -70,23 +70,23 @@ class GrpcDriver(Driver):
|
|
|
70
70
|
|
|
71
71
|
def __init__( # pylint: disable=too-many-arguments
|
|
72
72
|
self,
|
|
73
|
-
|
|
73
|
+
serverappio_service_address: str = SERVERAPPIO_API_DEFAULT_ADDRESS,
|
|
74
74
|
root_certificates: Optional[bytes] = None,
|
|
75
75
|
) -> None:
|
|
76
|
-
self._addr =
|
|
76
|
+
self._addr = serverappio_service_address
|
|
77
77
|
self._cert = root_certificates
|
|
78
78
|
self._run: Optional[Run] = None
|
|
79
|
-
self._grpc_stub: Optional[
|
|
79
|
+
self._grpc_stub: Optional[ServerAppIoStub] = None
|
|
80
80
|
self._channel: Optional[grpc.Channel] = None
|
|
81
81
|
self.node = Node(node_id=0, anonymous=True)
|
|
82
82
|
|
|
83
83
|
@property
|
|
84
84
|
def _is_connected(self) -> bool:
|
|
85
|
-
"""Check if connected to the
|
|
85
|
+
"""Check if connected to the ServerAppIo API server."""
|
|
86
86
|
return self._channel is not None
|
|
87
87
|
|
|
88
88
|
def _connect(self) -> None:
|
|
89
|
-
"""Connect to the
|
|
89
|
+
"""Connect to the ServerAppIo API.
|
|
90
90
|
|
|
91
91
|
This will not call GetRun.
|
|
92
92
|
"""
|
|
@@ -98,11 +98,11 @@ class GrpcDriver(Driver):
|
|
|
98
98
|
insecure=(self._cert is None),
|
|
99
99
|
root_certificates=self._cert,
|
|
100
100
|
)
|
|
101
|
-
self._grpc_stub =
|
|
101
|
+
self._grpc_stub = ServerAppIoStub(self._channel)
|
|
102
102
|
log(DEBUG, "[Driver] Connected to %s", self._addr)
|
|
103
103
|
|
|
104
104
|
def _disconnect(self) -> None:
|
|
105
|
-
"""Disconnect from the
|
|
105
|
+
"""Disconnect from the ServerAppIo API."""
|
|
106
106
|
if not self._is_connected:
|
|
107
107
|
log(DEBUG, "Already disconnected")
|
|
108
108
|
return
|
|
@@ -137,11 +137,11 @@ class GrpcDriver(Driver):
|
|
|
137
137
|
return Run(**vars(self._run))
|
|
138
138
|
|
|
139
139
|
@property
|
|
140
|
-
def _stub(self) ->
|
|
141
|
-
"""
|
|
140
|
+
def _stub(self) -> ServerAppIoStub:
|
|
141
|
+
"""ServerAppIo stub."""
|
|
142
142
|
if not self._is_connected:
|
|
143
143
|
self._connect()
|
|
144
|
-
return cast(
|
|
144
|
+
return cast(ServerAppIoStub, self._grpc_stub)
|
|
145
145
|
|
|
146
146
|
def _check_message(self, message: Message) -> None:
|
|
147
147
|
# Check if the message is valid
|