flwr-nightly 1.20.0.dev20250716__py3-none-any.whl → 1.20.0.dev20250717__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.
- flwr/common/record/array.py +2 -2
- flwr/common/serde.py +0 -28
- flwr/compat/client/app.py +14 -31
- flwr/proto/appio_pb2.py +18 -22
- flwr/proto/appio_pb2.pyi +21 -22
- flwr/proto/clientappio_pb2.py +12 -31
- flwr/proto/clientappio_pb2.pyi +0 -142
- flwr/proto/clientappio_pb2_grpc.py +128 -24
- flwr/proto/clientappio_pb2_grpc.pyi +57 -16
- flwr/server/fleet_event_log_interceptor.py +4 -0
- flwr/server/grid/grpc_grid.py +5 -2
- flwr/server/superlink/fleet/grpc_rere/server_interceptor.py +2 -5
- flwr/server/superlink/serverappio/serverappio_servicer.py +5 -9
- flwr/superexec/exec_event_log_interceptor.py +4 -0
- flwr/superexec/exec_license_interceptor.py +4 -0
- flwr/superexec/exec_user_auth_interceptor.py +4 -0
- flwr/supernode/runtime/run_clientapp.py +21 -15
- flwr/supernode/servicer/clientappio/clientappio_servicer.py +94 -25
- {flwr_nightly-1.20.0.dev20250716.dist-info → flwr_nightly-1.20.0.dev20250717.dist-info}/METADATA +1 -1
- {flwr_nightly-1.20.0.dev20250716.dist-info → flwr_nightly-1.20.0.dev20250717.dist-info}/RECORD +22 -22
- {flwr_nightly-1.20.0.dev20250716.dist-info → flwr_nightly-1.20.0.dev20250717.dist-info}/WHEEL +0 -0
- {flwr_nightly-1.20.0.dev20250716.dist-info → flwr_nightly-1.20.0.dev20250717.dist-info}/entry_points.txt +0 -0
@@ -2,7 +2,9 @@
|
|
2
2
|
"""Client and server classes corresponding to protobuf-defined services."""
|
3
3
|
import grpc
|
4
4
|
|
5
|
+
from flwr.proto import appio_pb2 as flwr_dot_proto_dot_appio__pb2
|
5
6
|
from flwr.proto import clientappio_pb2 as flwr_dot_proto_dot_clientappio__pb2
|
7
|
+
from flwr.proto import message_pb2 as flwr_dot_proto_dot_message__pb2
|
6
8
|
|
7
9
|
|
8
10
|
class ClientAppIoStub(object):
|
@@ -26,23 +28,38 @@ class ClientAppIoStub(object):
|
|
26
28
|
)
|
27
29
|
self.PullClientAppInputs = channel.unary_unary(
|
28
30
|
'/flwr.proto.ClientAppIo/PullClientAppInputs',
|
29
|
-
request_serializer=
|
30
|
-
response_deserializer=
|
31
|
+
request_serializer=flwr_dot_proto_dot_appio__pb2.PullAppInputsRequest.SerializeToString,
|
32
|
+
response_deserializer=flwr_dot_proto_dot_appio__pb2.PullAppInputsResponse.FromString,
|
31
33
|
)
|
32
34
|
self.PushClientAppOutputs = channel.unary_unary(
|
33
35
|
'/flwr.proto.ClientAppIo/PushClientAppOutputs',
|
34
|
-
request_serializer=
|
35
|
-
response_deserializer=
|
36
|
+
request_serializer=flwr_dot_proto_dot_appio__pb2.PushAppOutputsRequest.SerializeToString,
|
37
|
+
response_deserializer=flwr_dot_proto_dot_appio__pb2.PushAppOutputsResponse.FromString,
|
36
38
|
)
|
37
39
|
self.PushMessage = channel.unary_unary(
|
38
40
|
'/flwr.proto.ClientAppIo/PushMessage',
|
39
|
-
request_serializer=
|
40
|
-
response_deserializer=
|
41
|
+
request_serializer=flwr_dot_proto_dot_appio__pb2.PushAppMessagesRequest.SerializeToString,
|
42
|
+
response_deserializer=flwr_dot_proto_dot_appio__pb2.PushAppMessagesResponse.FromString,
|
41
43
|
)
|
42
44
|
self.PullMessage = channel.unary_unary(
|
43
45
|
'/flwr.proto.ClientAppIo/PullMessage',
|
44
|
-
request_serializer=
|
45
|
-
response_deserializer=
|
46
|
+
request_serializer=flwr_dot_proto_dot_appio__pb2.PullAppMessagesRequest.SerializeToString,
|
47
|
+
response_deserializer=flwr_dot_proto_dot_appio__pb2.PullAppMessagesResponse.FromString,
|
48
|
+
)
|
49
|
+
self.PushObject = channel.unary_unary(
|
50
|
+
'/flwr.proto.ClientAppIo/PushObject',
|
51
|
+
request_serializer=flwr_dot_proto_dot_message__pb2.PushObjectRequest.SerializeToString,
|
52
|
+
response_deserializer=flwr_dot_proto_dot_message__pb2.PushObjectResponse.FromString,
|
53
|
+
)
|
54
|
+
self.PullObject = channel.unary_unary(
|
55
|
+
'/flwr.proto.ClientAppIo/PullObject',
|
56
|
+
request_serializer=flwr_dot_proto_dot_message__pb2.PullObjectRequest.SerializeToString,
|
57
|
+
response_deserializer=flwr_dot_proto_dot_message__pb2.PullObjectResponse.FromString,
|
58
|
+
)
|
59
|
+
self.ConfirmMessageReceived = channel.unary_unary(
|
60
|
+
'/flwr.proto.ClientAppIo/ConfirmMessageReceived',
|
61
|
+
request_serializer=flwr_dot_proto_dot_message__pb2.ConfirmMessageReceivedRequest.SerializeToString,
|
62
|
+
response_deserializer=flwr_dot_proto_dot_message__pb2.ConfirmMessageReceivedResponse.FromString,
|
46
63
|
)
|
47
64
|
|
48
65
|
|
@@ -91,6 +108,27 @@ class ClientAppIoServicer(object):
|
|
91
108
|
context.set_details('Method not implemented!')
|
92
109
|
raise NotImplementedError('Method not implemented!')
|
93
110
|
|
111
|
+
def PushObject(self, request, context):
|
112
|
+
"""Push Object
|
113
|
+
"""
|
114
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
115
|
+
context.set_details('Method not implemented!')
|
116
|
+
raise NotImplementedError('Method not implemented!')
|
117
|
+
|
118
|
+
def PullObject(self, request, context):
|
119
|
+
"""Pull Object
|
120
|
+
"""
|
121
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
122
|
+
context.set_details('Method not implemented!')
|
123
|
+
raise NotImplementedError('Method not implemented!')
|
124
|
+
|
125
|
+
def ConfirmMessageReceived(self, request, context):
|
126
|
+
"""Confirm Message Received
|
127
|
+
"""
|
128
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
129
|
+
context.set_details('Method not implemented!')
|
130
|
+
raise NotImplementedError('Method not implemented!')
|
131
|
+
|
94
132
|
|
95
133
|
def add_ClientAppIoServicer_to_server(servicer, server):
|
96
134
|
rpc_method_handlers = {
|
@@ -106,23 +144,38 @@ def add_ClientAppIoServicer_to_server(servicer, server):
|
|
106
144
|
),
|
107
145
|
'PullClientAppInputs': grpc.unary_unary_rpc_method_handler(
|
108
146
|
servicer.PullClientAppInputs,
|
109
|
-
request_deserializer=
|
110
|
-
response_serializer=
|
147
|
+
request_deserializer=flwr_dot_proto_dot_appio__pb2.PullAppInputsRequest.FromString,
|
148
|
+
response_serializer=flwr_dot_proto_dot_appio__pb2.PullAppInputsResponse.SerializeToString,
|
111
149
|
),
|
112
150
|
'PushClientAppOutputs': grpc.unary_unary_rpc_method_handler(
|
113
151
|
servicer.PushClientAppOutputs,
|
114
|
-
request_deserializer=
|
115
|
-
response_serializer=
|
152
|
+
request_deserializer=flwr_dot_proto_dot_appio__pb2.PushAppOutputsRequest.FromString,
|
153
|
+
response_serializer=flwr_dot_proto_dot_appio__pb2.PushAppOutputsResponse.SerializeToString,
|
116
154
|
),
|
117
155
|
'PushMessage': grpc.unary_unary_rpc_method_handler(
|
118
156
|
servicer.PushMessage,
|
119
|
-
request_deserializer=
|
120
|
-
response_serializer=
|
157
|
+
request_deserializer=flwr_dot_proto_dot_appio__pb2.PushAppMessagesRequest.FromString,
|
158
|
+
response_serializer=flwr_dot_proto_dot_appio__pb2.PushAppMessagesResponse.SerializeToString,
|
121
159
|
),
|
122
160
|
'PullMessage': grpc.unary_unary_rpc_method_handler(
|
123
161
|
servicer.PullMessage,
|
124
|
-
request_deserializer=
|
125
|
-
response_serializer=
|
162
|
+
request_deserializer=flwr_dot_proto_dot_appio__pb2.PullAppMessagesRequest.FromString,
|
163
|
+
response_serializer=flwr_dot_proto_dot_appio__pb2.PullAppMessagesResponse.SerializeToString,
|
164
|
+
),
|
165
|
+
'PushObject': grpc.unary_unary_rpc_method_handler(
|
166
|
+
servicer.PushObject,
|
167
|
+
request_deserializer=flwr_dot_proto_dot_message__pb2.PushObjectRequest.FromString,
|
168
|
+
response_serializer=flwr_dot_proto_dot_message__pb2.PushObjectResponse.SerializeToString,
|
169
|
+
),
|
170
|
+
'PullObject': grpc.unary_unary_rpc_method_handler(
|
171
|
+
servicer.PullObject,
|
172
|
+
request_deserializer=flwr_dot_proto_dot_message__pb2.PullObjectRequest.FromString,
|
173
|
+
response_serializer=flwr_dot_proto_dot_message__pb2.PullObjectResponse.SerializeToString,
|
174
|
+
),
|
175
|
+
'ConfirmMessageReceived': grpc.unary_unary_rpc_method_handler(
|
176
|
+
servicer.ConfirmMessageReceived,
|
177
|
+
request_deserializer=flwr_dot_proto_dot_message__pb2.ConfirmMessageReceivedRequest.FromString,
|
178
|
+
response_serializer=flwr_dot_proto_dot_message__pb2.ConfirmMessageReceivedResponse.SerializeToString,
|
126
179
|
),
|
127
180
|
}
|
128
181
|
generic_handler = grpc.method_handlers_generic_handler(
|
@@ -180,8 +233,8 @@ class ClientAppIo(object):
|
|
180
233
|
timeout=None,
|
181
234
|
metadata=None):
|
182
235
|
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ClientAppIo/PullClientAppInputs',
|
183
|
-
|
184
|
-
|
236
|
+
flwr_dot_proto_dot_appio__pb2.PullAppInputsRequest.SerializeToString,
|
237
|
+
flwr_dot_proto_dot_appio__pb2.PullAppInputsResponse.FromString,
|
185
238
|
options, channel_credentials,
|
186
239
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
187
240
|
|
@@ -197,8 +250,8 @@ class ClientAppIo(object):
|
|
197
250
|
timeout=None,
|
198
251
|
metadata=None):
|
199
252
|
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ClientAppIo/PushClientAppOutputs',
|
200
|
-
|
201
|
-
|
253
|
+
flwr_dot_proto_dot_appio__pb2.PushAppOutputsRequest.SerializeToString,
|
254
|
+
flwr_dot_proto_dot_appio__pb2.PushAppOutputsResponse.FromString,
|
202
255
|
options, channel_credentials,
|
203
256
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
204
257
|
|
@@ -214,8 +267,8 @@ class ClientAppIo(object):
|
|
214
267
|
timeout=None,
|
215
268
|
metadata=None):
|
216
269
|
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ClientAppIo/PushMessage',
|
217
|
-
|
218
|
-
|
270
|
+
flwr_dot_proto_dot_appio__pb2.PushAppMessagesRequest.SerializeToString,
|
271
|
+
flwr_dot_proto_dot_appio__pb2.PushAppMessagesResponse.FromString,
|
219
272
|
options, channel_credentials,
|
220
273
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
221
274
|
|
@@ -231,7 +284,58 @@ class ClientAppIo(object):
|
|
231
284
|
timeout=None,
|
232
285
|
metadata=None):
|
233
286
|
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ClientAppIo/PullMessage',
|
234
|
-
|
235
|
-
|
287
|
+
flwr_dot_proto_dot_appio__pb2.PullAppMessagesRequest.SerializeToString,
|
288
|
+
flwr_dot_proto_dot_appio__pb2.PullAppMessagesResponse.FromString,
|
289
|
+
options, channel_credentials,
|
290
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
291
|
+
|
292
|
+
@staticmethod
|
293
|
+
def PushObject(request,
|
294
|
+
target,
|
295
|
+
options=(),
|
296
|
+
channel_credentials=None,
|
297
|
+
call_credentials=None,
|
298
|
+
insecure=False,
|
299
|
+
compression=None,
|
300
|
+
wait_for_ready=None,
|
301
|
+
timeout=None,
|
302
|
+
metadata=None):
|
303
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ClientAppIo/PushObject',
|
304
|
+
flwr_dot_proto_dot_message__pb2.PushObjectRequest.SerializeToString,
|
305
|
+
flwr_dot_proto_dot_message__pb2.PushObjectResponse.FromString,
|
306
|
+
options, channel_credentials,
|
307
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
308
|
+
|
309
|
+
@staticmethod
|
310
|
+
def PullObject(request,
|
311
|
+
target,
|
312
|
+
options=(),
|
313
|
+
channel_credentials=None,
|
314
|
+
call_credentials=None,
|
315
|
+
insecure=False,
|
316
|
+
compression=None,
|
317
|
+
wait_for_ready=None,
|
318
|
+
timeout=None,
|
319
|
+
metadata=None):
|
320
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ClientAppIo/PullObject',
|
321
|
+
flwr_dot_proto_dot_message__pb2.PullObjectRequest.SerializeToString,
|
322
|
+
flwr_dot_proto_dot_message__pb2.PullObjectResponse.FromString,
|
323
|
+
options, channel_credentials,
|
324
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
325
|
+
|
326
|
+
@staticmethod
|
327
|
+
def ConfirmMessageReceived(request,
|
328
|
+
target,
|
329
|
+
options=(),
|
330
|
+
channel_credentials=None,
|
331
|
+
call_credentials=None,
|
332
|
+
insecure=False,
|
333
|
+
compression=None,
|
334
|
+
wait_for_ready=None,
|
335
|
+
timeout=None,
|
336
|
+
metadata=None):
|
337
|
+
return grpc.experimental.unary_unary(request, target, '/flwr.proto.ClientAppIo/ConfirmMessageReceived',
|
338
|
+
flwr_dot_proto_dot_message__pb2.ConfirmMessageReceivedRequest.SerializeToString,
|
339
|
+
flwr_dot_proto_dot_message__pb2.ConfirmMessageReceivedResponse.FromString,
|
236
340
|
options, channel_credentials,
|
237
341
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
@@ -3,7 +3,9 @@
|
|
3
3
|
isort:skip_file
|
4
4
|
"""
|
5
5
|
import abc
|
6
|
+
import flwr.proto.appio_pb2
|
6
7
|
import flwr.proto.clientappio_pb2
|
8
|
+
import flwr.proto.message_pb2
|
7
9
|
import grpc
|
8
10
|
|
9
11
|
class ClientAppIoStub:
|
@@ -19,25 +21,40 @@ class ClientAppIoStub:
|
|
19
21
|
"""Request token"""
|
20
22
|
|
21
23
|
PullClientAppInputs: grpc.UnaryUnaryMultiCallable[
|
22
|
-
flwr.proto.
|
23
|
-
flwr.proto.
|
24
|
+
flwr.proto.appio_pb2.PullAppInputsRequest,
|
25
|
+
flwr.proto.appio_pb2.PullAppInputsResponse]
|
24
26
|
"""Pull client app inputs"""
|
25
27
|
|
26
28
|
PushClientAppOutputs: grpc.UnaryUnaryMultiCallable[
|
27
|
-
flwr.proto.
|
28
|
-
flwr.proto.
|
29
|
+
flwr.proto.appio_pb2.PushAppOutputsRequest,
|
30
|
+
flwr.proto.appio_pb2.PushAppOutputsResponse]
|
29
31
|
"""Push client app outputs"""
|
30
32
|
|
31
33
|
PushMessage: grpc.UnaryUnaryMultiCallable[
|
32
|
-
flwr.proto.
|
33
|
-
flwr.proto.
|
34
|
+
flwr.proto.appio_pb2.PushAppMessagesRequest,
|
35
|
+
flwr.proto.appio_pb2.PushAppMessagesResponse]
|
34
36
|
"""Push Message"""
|
35
37
|
|
36
38
|
PullMessage: grpc.UnaryUnaryMultiCallable[
|
37
|
-
flwr.proto.
|
38
|
-
flwr.proto.
|
39
|
+
flwr.proto.appio_pb2.PullAppMessagesRequest,
|
40
|
+
flwr.proto.appio_pb2.PullAppMessagesResponse]
|
39
41
|
"""Pull Message"""
|
40
42
|
|
43
|
+
PushObject: grpc.UnaryUnaryMultiCallable[
|
44
|
+
flwr.proto.message_pb2.PushObjectRequest,
|
45
|
+
flwr.proto.message_pb2.PushObjectResponse]
|
46
|
+
"""Push Object"""
|
47
|
+
|
48
|
+
PullObject: grpc.UnaryUnaryMultiCallable[
|
49
|
+
flwr.proto.message_pb2.PullObjectRequest,
|
50
|
+
flwr.proto.message_pb2.PullObjectResponse]
|
51
|
+
"""Pull Object"""
|
52
|
+
|
53
|
+
ConfirmMessageReceived: grpc.UnaryUnaryMultiCallable[
|
54
|
+
flwr.proto.message_pb2.ConfirmMessageReceivedRequest,
|
55
|
+
flwr.proto.message_pb2.ConfirmMessageReceivedResponse]
|
56
|
+
"""Confirm Message Received"""
|
57
|
+
|
41
58
|
|
42
59
|
class ClientAppIoServicer(metaclass=abc.ABCMeta):
|
43
60
|
@abc.abstractmethod
|
@@ -58,35 +75,59 @@ class ClientAppIoServicer(metaclass=abc.ABCMeta):
|
|
58
75
|
|
59
76
|
@abc.abstractmethod
|
60
77
|
def PullClientAppInputs(self,
|
61
|
-
request: flwr.proto.
|
78
|
+
request: flwr.proto.appio_pb2.PullAppInputsRequest,
|
62
79
|
context: grpc.ServicerContext,
|
63
|
-
) -> flwr.proto.
|
80
|
+
) -> flwr.proto.appio_pb2.PullAppInputsResponse:
|
64
81
|
"""Pull client app inputs"""
|
65
82
|
pass
|
66
83
|
|
67
84
|
@abc.abstractmethod
|
68
85
|
def PushClientAppOutputs(self,
|
69
|
-
request: flwr.proto.
|
86
|
+
request: flwr.proto.appio_pb2.PushAppOutputsRequest,
|
70
87
|
context: grpc.ServicerContext,
|
71
|
-
) -> flwr.proto.
|
88
|
+
) -> flwr.proto.appio_pb2.PushAppOutputsResponse:
|
72
89
|
"""Push client app outputs"""
|
73
90
|
pass
|
74
91
|
|
75
92
|
@abc.abstractmethod
|
76
93
|
def PushMessage(self,
|
77
|
-
request: flwr.proto.
|
94
|
+
request: flwr.proto.appio_pb2.PushAppMessagesRequest,
|
78
95
|
context: grpc.ServicerContext,
|
79
|
-
) -> flwr.proto.
|
96
|
+
) -> flwr.proto.appio_pb2.PushAppMessagesResponse:
|
80
97
|
"""Push Message"""
|
81
98
|
pass
|
82
99
|
|
83
100
|
@abc.abstractmethod
|
84
101
|
def PullMessage(self,
|
85
|
-
request: flwr.proto.
|
102
|
+
request: flwr.proto.appio_pb2.PullAppMessagesRequest,
|
86
103
|
context: grpc.ServicerContext,
|
87
|
-
) -> flwr.proto.
|
104
|
+
) -> flwr.proto.appio_pb2.PullAppMessagesResponse:
|
88
105
|
"""Pull Message"""
|
89
106
|
pass
|
90
107
|
|
108
|
+
@abc.abstractmethod
|
109
|
+
def PushObject(self,
|
110
|
+
request: flwr.proto.message_pb2.PushObjectRequest,
|
111
|
+
context: grpc.ServicerContext,
|
112
|
+
) -> flwr.proto.message_pb2.PushObjectResponse:
|
113
|
+
"""Push Object"""
|
114
|
+
pass
|
115
|
+
|
116
|
+
@abc.abstractmethod
|
117
|
+
def PullObject(self,
|
118
|
+
request: flwr.proto.message_pb2.PullObjectRequest,
|
119
|
+
context: grpc.ServicerContext,
|
120
|
+
) -> flwr.proto.message_pb2.PullObjectResponse:
|
121
|
+
"""Pull Object"""
|
122
|
+
pass
|
123
|
+
|
124
|
+
@abc.abstractmethod
|
125
|
+
def ConfirmMessageReceived(self,
|
126
|
+
request: flwr.proto.message_pb2.ConfirmMessageReceivedRequest,
|
127
|
+
context: grpc.ServicerContext,
|
128
|
+
) -> flwr.proto.message_pb2.ConfirmMessageReceivedResponse:
|
129
|
+
"""Confirm Message Received"""
|
130
|
+
pass
|
131
|
+
|
91
132
|
|
92
133
|
def add_ClientAppIoServicer_to_server(servicer: ClientAppIoServicer, server: grpc.Server) -> None: ...
|
@@ -41,6 +41,10 @@ class FleetEventLogInterceptor(grpc.ServerInterceptor): # type: ignore
|
|
41
41
|
if event logger is enabled on the SuperLink, else, terminate RPC call by setting
|
42
42
|
context to abort.
|
43
43
|
"""
|
44
|
+
# Only apply to Fleet service
|
45
|
+
if not handler_call_details.method.startswith("/flwr.proto.Fleet/"):
|
46
|
+
return continuation(handler_call_details)
|
47
|
+
|
44
48
|
# One of the method handlers in
|
45
49
|
# `flwr.server.superlink.fleet.grpc_rere.fleet_servicer.FleetServicer`
|
46
50
|
method_handler: grpc.RpcMethodHandler = continuation(handler_call_details)
|
flwr/server/grid/grpc_grid.py
CHANGED
@@ -31,6 +31,7 @@ from flwr.common.grpc import create_channel, on_channel_state_change
|
|
31
31
|
from flwr.common.inflatable import (
|
32
32
|
get_all_nested_objects,
|
33
33
|
get_object_tree,
|
34
|
+
iterate_object_tree,
|
34
35
|
no_object_id_recompute,
|
35
36
|
)
|
36
37
|
from flwr.common.inflatable_protobuf_utils import (
|
@@ -304,10 +305,12 @@ class GrpcGrid(Grid):
|
|
304
305
|
)
|
305
306
|
# Pull Messages from store
|
306
307
|
inflated_msgs: list[Message] = []
|
307
|
-
for msg_proto in res.messages_list:
|
308
|
+
for msg_proto, msg_tree in zip(res.messages_list, res.message_object_trees):
|
308
309
|
msg_id = msg_proto.metadata.message_id
|
309
310
|
all_object_contents = pull_objects(
|
310
|
-
|
311
|
+
object_ids=[
|
312
|
+
tree.object_id for tree in iterate_object_tree(msg_tree)
|
313
|
+
],
|
311
314
|
pull_object_fn=make_pull_object_fn_protobuf(
|
312
315
|
pull_object_protobuf=self._stub.PullObject,
|
313
316
|
node=self.node,
|
@@ -81,12 +81,9 @@ class AuthenticateServerInterceptor(grpc.ServerInterceptor): # type: ignore
|
|
81
81
|
metadata sent by the node. Continue RPC call if node is authenticated, else,
|
82
82
|
terminate RPC call by setting context to abort.
|
83
83
|
"""
|
84
|
-
#
|
84
|
+
# Only apply to Fleet service
|
85
85
|
if not handler_call_details.method.startswith("/flwr.proto.Fleet/"):
|
86
|
-
return
|
87
|
-
"This request should be sent to a different service.",
|
88
|
-
grpc.StatusCode.FAILED_PRECONDITION,
|
89
|
-
)
|
86
|
+
return continuation(handler_call_details)
|
90
87
|
|
91
88
|
state = self.state_factory.state()
|
92
89
|
metadata_dict = dict(handler_call_details.invocation_metadata)
|
@@ -27,7 +27,6 @@ from flwr.common.inflatable import (
|
|
27
27
|
UnexpectedObjectContentError,
|
28
28
|
get_all_nested_objects,
|
29
29
|
get_object_tree,
|
30
|
-
iterate_object_tree,
|
31
30
|
no_object_id_recompute,
|
32
31
|
)
|
33
32
|
from flwr.common.logger import log
|
@@ -65,7 +64,6 @@ from flwr.proto.log_pb2 import ( # pylint: disable=E0611
|
|
65
64
|
from flwr.proto.message_pb2 import ( # pylint: disable=E0611
|
66
65
|
ConfirmMessageReceivedRequest,
|
67
66
|
ConfirmMessageReceivedResponse,
|
68
|
-
ObjectIDs,
|
69
67
|
PullObjectRequest,
|
70
68
|
PullObjectResponse,
|
71
69
|
PushObjectRequest,
|
@@ -227,7 +225,7 @@ class ServerAppIoServicer(serverappio_pb2_grpc.ServerAppIoServicer):
|
|
227
225
|
|
228
226
|
# Convert Messages to proto
|
229
227
|
messages_list = []
|
230
|
-
|
228
|
+
trees = []
|
231
229
|
while messages_res:
|
232
230
|
msg = messages_res.pop(0)
|
233
231
|
|
@@ -238,22 +236,20 @@ class ServerAppIoServicer(serverappio_pb2_grpc.ServerAppIoServicer):
|
|
238
236
|
request_name="PullMessages",
|
239
237
|
detail="`message.metadata` has mismatched `run_id`",
|
240
238
|
)
|
241
|
-
messages_list.append(message_to_proto(msg))
|
242
239
|
|
243
240
|
try:
|
244
241
|
msg_object_id = msg.metadata.message_id
|
245
242
|
obj_tree = store.get_object_tree(msg_object_id)
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
objects_to_pull[msg_object_id] = ObjectIDs(object_ids=descendants)
|
243
|
+
# Add message and object tree to the response
|
244
|
+
messages_list.append(message_to_proto(msg))
|
245
|
+
trees.append(obj_tree)
|
250
246
|
except NoObjectInStoreError as e:
|
251
247
|
log(ERROR, e.message)
|
252
248
|
# Delete message ins from state
|
253
249
|
state.delete_messages(message_ins_ids={msg_object_id})
|
254
250
|
|
255
251
|
return PullAppMessagesResponse(
|
256
|
-
messages_list=messages_list,
|
252
|
+
messages_list=messages_list, message_object_trees=trees
|
257
253
|
)
|
258
254
|
|
259
255
|
def GetRun(
|
@@ -44,6 +44,10 @@ class ExecEventLogInterceptor(grpc.ServerInterceptor): # type: ignore
|
|
44
44
|
Continue RPC call if event logger is enabled on the SuperLink, else, terminate
|
45
45
|
RPC call by setting context to abort.
|
46
46
|
"""
|
47
|
+
# Only apply to Exec service
|
48
|
+
if not handler_call_details.method.startswith("/flwr.proto.Exec/"):
|
49
|
+
return continuation(handler_call_details)
|
50
|
+
|
47
51
|
# One of the method handlers in
|
48
52
|
# `flwr.superexec.exec_servicer.ExecServicer`
|
49
53
|
method_handler: grpc.RpcMethodHandler = continuation(handler_call_details)
|
@@ -42,6 +42,10 @@ class ExecLicenseInterceptor(grpc.ServerInterceptor): # type: ignore
|
|
42
42
|
Continue RPC call if license check is enabled and passes, else, terminate RPC
|
43
43
|
call by setting context to abort.
|
44
44
|
"""
|
45
|
+
# Only apply to Exec service
|
46
|
+
if not handler_call_details.method.startswith("/flwr.proto.Exec/"):
|
47
|
+
return continuation(handler_call_details)
|
48
|
+
|
45
49
|
# One of the method handlers in
|
46
50
|
# `flwr.superexec.exec_servicer.ExecServicer`
|
47
51
|
method_handler: grpc.RpcMethodHandler = continuation(handler_call_details)
|
@@ -72,6 +72,10 @@ class ExecUserAuthInterceptor(grpc.ServerInterceptor): # type: ignore
|
|
72
72
|
by validating auth metadata sent by the user. Continue RPC call if user is
|
73
73
|
authenticated, else, terminate RPC call by setting context to abort.
|
74
74
|
"""
|
75
|
+
# Only apply to Exec service
|
76
|
+
if not handler_call_details.method.startswith("/flwr.proto.Exec/"):
|
77
|
+
return continuation(handler_call_details)
|
78
|
+
|
75
79
|
# One of the method handlers in
|
76
80
|
# `flwr.superexec.exec_servicer.ExecServicer`
|
77
81
|
method_handler: grpc.RpcMethodHandler = continuation(handler_call_details)
|
@@ -43,18 +43,20 @@ from flwr.common.serde import (
|
|
43
43
|
run_from_proto,
|
44
44
|
)
|
45
45
|
from flwr.common.typing import Fab, Run
|
46
|
+
from flwr.proto.appio_pb2 import ( # pylint: disable=E0611
|
47
|
+
PullAppInputsRequest,
|
48
|
+
PullAppInputsResponse,
|
49
|
+
PullAppMessagesRequest,
|
50
|
+
PullAppMessagesResponse,
|
51
|
+
PushAppMessagesRequest,
|
52
|
+
PushAppOutputsRequest,
|
53
|
+
PushAppOutputsResponse,
|
54
|
+
)
|
46
55
|
|
47
56
|
# pylint: disable=E0611
|
48
57
|
from flwr.proto.clientappio_pb2 import (
|
49
58
|
GetRunIdsWithPendingMessagesRequest,
|
50
59
|
GetRunIdsWithPendingMessagesResponse,
|
51
|
-
PullClientAppInputsRequest,
|
52
|
-
PullClientAppInputsResponse,
|
53
|
-
PullMessageRequest,
|
54
|
-
PullMessageResponse,
|
55
|
-
PushClientAppOutputsRequest,
|
56
|
-
PushClientAppOutputsResponse,
|
57
|
-
PushMessageRequest,
|
58
60
|
RequestTokenRequest,
|
59
61
|
RequestTokenResponse,
|
60
62
|
)
|
@@ -203,12 +205,14 @@ def pull_clientappinputs(
|
|
203
205
|
log(INFO, "[flwr-clientapp] Pull `ClientAppInputs` for token %s", masked_token)
|
204
206
|
try:
|
205
207
|
# Pull Message
|
206
|
-
|
207
|
-
|
208
|
+
pull_msg_res: PullAppMessagesResponse = stub.PullMessage(
|
209
|
+
PullAppMessagesRequest(token=token)
|
210
|
+
)
|
211
|
+
message = message_from_proto(pull_msg_res.messages_list[0])
|
208
212
|
|
209
213
|
# Pull Context, Run and (optional) FAB
|
210
|
-
res:
|
211
|
-
|
214
|
+
res: PullAppInputsResponse = stub.PullClientAppInputs(
|
215
|
+
PullAppInputsRequest(token=token)
|
212
216
|
)
|
213
217
|
context = context_from_proto(res.context)
|
214
218
|
run = run_from_proto(res.run)
|
@@ -221,7 +225,7 @@ def pull_clientappinputs(
|
|
221
225
|
|
222
226
|
def push_clientappoutputs(
|
223
227
|
stub: ClientAppIoStub, token: str, message: Message, context: Context
|
224
|
-
) ->
|
228
|
+
) -> PushAppOutputsResponse:
|
225
229
|
"""Push ClientAppOutputs to SuperNode."""
|
226
230
|
masked_token = mask_string(token)
|
227
231
|
log(INFO, "[flwr-clientapp] Push `ClientAppOutputs` for token %s", masked_token)
|
@@ -233,11 +237,13 @@ def push_clientappoutputs(
|
|
233
237
|
try:
|
234
238
|
|
235
239
|
# Push Message
|
236
|
-
_ = stub.PushMessage(
|
240
|
+
_ = stub.PushMessage(
|
241
|
+
PushAppMessagesRequest(token=token, messages_list=[proto_message])
|
242
|
+
)
|
237
243
|
|
238
244
|
# Push Context
|
239
|
-
res:
|
240
|
-
|
245
|
+
res: PushAppOutputsResponse = stub.PushClientAppOutputs(
|
246
|
+
PushAppOutputsRequest(token=token, context=proto_context)
|
241
247
|
)
|
242
248
|
return res
|
243
249
|
except grpc.RpcError as e:
|