flwr-nightly 1.19.0.dev20250604__py3-none-any.whl → 1.19.0.dev20250605__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/client/grpc_rere_client/connection.py +6 -2
- flwr/common/message.py +11 -0
- flwr/server/compat/app_utils.py +50 -28
- flwr/server/grid/grpc_grid.py +5 -2
- {flwr_nightly-1.19.0.dev20250604.dist-info → flwr_nightly-1.19.0.dev20250605.dist-info}/METADATA +1 -1
- {flwr_nightly-1.19.0.dev20250604.dist-info → flwr_nightly-1.19.0.dev20250605.dist-info}/RECORD +8 -8
- {flwr_nightly-1.19.0.dev20250604.dist-info → flwr_nightly-1.19.0.dev20250605.dist-info}/WHEEL +0 -0
- {flwr_nightly-1.19.0.dev20250604.dist-info → flwr_nightly-1.19.0.dev20250605.dist-info}/entry_points.txt +0 -0
@@ -35,7 +35,11 @@ from flwr.common.inflatable_grpc_utils import (
|
|
35
35
|
push_object_to_servicer,
|
36
36
|
)
|
37
37
|
from flwr.common.logger import log
|
38
|
-
from flwr.common.message import
|
38
|
+
from flwr.common.message import (
|
39
|
+
Message,
|
40
|
+
get_message_to_descendant_id_mapping,
|
41
|
+
remove_content_from_message,
|
42
|
+
)
|
39
43
|
from flwr.common.retry_invoker import RetryInvoker, _wrap_stub
|
40
44
|
from flwr.common.secure_aggregation.crypto.symmetric_encryption import (
|
41
45
|
generate_key_pairs,
|
@@ -305,7 +309,7 @@ def grpc_request_response( # pylint: disable=R0913,R0914,R0915,R0917
|
|
305
309
|
return
|
306
310
|
|
307
311
|
# Serialize Message
|
308
|
-
message_proto = message_to_proto(message=message)
|
312
|
+
message_proto = message_to_proto(message=remove_content_from_message(message))
|
309
313
|
descendants_mapping = get_message_to_descendant_id_mapping(message)
|
310
314
|
request = PushMessagesRequest(
|
311
315
|
node=node,
|
flwr/common/message.py
CHANGED
@@ -426,6 +426,17 @@ def make_message(
|
|
426
426
|
return Message(metadata=metadata, content=content, error=error) # type: ignore
|
427
427
|
|
428
428
|
|
429
|
+
def remove_content_from_message(message: Message) -> Message:
|
430
|
+
"""Return a copy of the Message but with an empty RecordDict as content.
|
431
|
+
|
432
|
+
If message has no content, it returns itself.
|
433
|
+
"""
|
434
|
+
if message.has_error():
|
435
|
+
return message
|
436
|
+
|
437
|
+
return make_message(metadata=message.metadata, content=RecordDict())
|
438
|
+
|
439
|
+
|
429
440
|
def _limit_reply_ttl(
|
430
441
|
current: float, reply_ttl: float | None, reply_to: Message
|
431
442
|
) -> float:
|
flwr/server/compat/app_utils.py
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
import threading
|
19
|
+
from typing import Any, Callable
|
19
20
|
|
20
21
|
from flwr.common.typing import RunNotRunningException
|
21
22
|
|
@@ -80,36 +81,57 @@ def _update_client_manager(
|
|
80
81
|
"""Update the nodes list in the client manager."""
|
81
82
|
# Loop until the grid is disconnected
|
82
83
|
registered_nodes: dict[int, GridClientProxy] = {}
|
84
|
+
lock = threading.RLock()
|
85
|
+
|
86
|
+
def update_registered_nodes() -> None:
|
87
|
+
with lock:
|
88
|
+
all_node_ids = set(grid.get_node_ids())
|
89
|
+
dead_nodes = set(registered_nodes).difference(all_node_ids)
|
90
|
+
new_nodes = all_node_ids.difference(registered_nodes)
|
91
|
+
|
92
|
+
# Unregister dead nodes
|
93
|
+
for node_id in dead_nodes:
|
94
|
+
client_proxy = registered_nodes[node_id]
|
95
|
+
client_manager.unregister(client_proxy)
|
96
|
+
del registered_nodes[node_id]
|
97
|
+
|
98
|
+
# Register new nodes
|
99
|
+
for node_id in new_nodes:
|
100
|
+
client_proxy = GridClientProxy(
|
101
|
+
node_id=node_id,
|
102
|
+
grid=grid,
|
103
|
+
run_id=grid.run.run_id,
|
104
|
+
)
|
105
|
+
if client_manager.register(client_proxy):
|
106
|
+
registered_nodes[node_id] = client_proxy
|
107
|
+
else:
|
108
|
+
raise RuntimeError("Could not register node.")
|
109
|
+
|
110
|
+
# Get the wrapped method of ClientManager instance
|
111
|
+
def get_wrapped_method(method_name: str) -> Callable[..., Any]:
|
112
|
+
original_method = getattr(client_manager, method_name)
|
113
|
+
|
114
|
+
def wrapped_method(*args: Any, **kwargs: Any) -> Any:
|
115
|
+
# Update registered nodes before calling the original method
|
116
|
+
update_registered_nodes()
|
117
|
+
return original_method(*args, **kwargs)
|
118
|
+
|
119
|
+
return wrapped_method
|
120
|
+
|
121
|
+
# Wrap the ClientManager
|
122
|
+
for method_name in ["num_available", "all", "sample"]:
|
123
|
+
setattr(client_manager, method_name, get_wrapped_method(method_name))
|
124
|
+
|
125
|
+
c_done.set()
|
126
|
+
|
83
127
|
while not f_stop.is_set():
|
128
|
+
# Sleep for 5 seconds
|
129
|
+
if not f_stop.is_set():
|
130
|
+
f_stop.wait(5)
|
131
|
+
|
84
132
|
try:
|
85
|
-
|
133
|
+
# Update registered nodes
|
134
|
+
update_registered_nodes()
|
86
135
|
except RunNotRunningException:
|
87
136
|
f_stop.set()
|
88
137
|
break
|
89
|
-
dead_nodes = set(registered_nodes).difference(all_node_ids)
|
90
|
-
new_nodes = all_node_ids.difference(registered_nodes)
|
91
|
-
|
92
|
-
# Unregister dead nodes
|
93
|
-
for node_id in dead_nodes:
|
94
|
-
client_proxy = registered_nodes[node_id]
|
95
|
-
client_manager.unregister(client_proxy)
|
96
|
-
del registered_nodes[node_id]
|
97
|
-
|
98
|
-
# Register new nodes
|
99
|
-
for node_id in new_nodes:
|
100
|
-
client_proxy = GridClientProxy(
|
101
|
-
node_id=node_id,
|
102
|
-
grid=grid,
|
103
|
-
run_id=grid.run.run_id,
|
104
|
-
)
|
105
|
-
if client_manager.register(client_proxy):
|
106
|
-
registered_nodes[node_id] = client_proxy
|
107
|
-
else:
|
108
|
-
raise RuntimeError("Could not register node.")
|
109
|
-
|
110
|
-
# Flag first pass for nodes registration is completed
|
111
|
-
c_done.set()
|
112
|
-
|
113
|
-
# Sleep for 3 seconds
|
114
|
-
if not f_stop.is_set():
|
115
|
-
f_stop.wait(3)
|
flwr/server/grid/grpc_grid.py
CHANGED
@@ -33,7 +33,10 @@ from flwr.common.inflatable_grpc_utils import (
|
|
33
33
|
push_object_to_servicer,
|
34
34
|
)
|
35
35
|
from flwr.common.logger import log, warn_deprecated_feature
|
36
|
-
from flwr.common.message import
|
36
|
+
from flwr.common.message import (
|
37
|
+
get_message_to_descendant_id_mapping,
|
38
|
+
remove_content_from_message,
|
39
|
+
)
|
37
40
|
from flwr.common.retry_invoker import _make_simple_grpc_retry_invoker, _wrap_stub
|
38
41
|
from flwr.common.serde import message_to_proto, run_from_proto
|
39
42
|
from flwr.common.typing import Run
|
@@ -210,7 +213,7 @@ class GrpcGrid(Grid):
|
|
210
213
|
# Call GrpcServerAppIoStub method
|
211
214
|
res: PushInsMessagesResponse = self._stub.PushMessages(
|
212
215
|
PushInsMessagesRequest(
|
213
|
-
messages_list=[message_to_proto(message)],
|
216
|
+
messages_list=[message_to_proto(remove_content_from_message(message))],
|
214
217
|
run_id=run_id,
|
215
218
|
msg_to_descendant_mapping=descendants_mapping,
|
216
219
|
)
|
{flwr_nightly-1.19.0.dev20250604.dist-info → flwr_nightly-1.19.0.dev20250605.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: flwr-nightly
|
3
|
-
Version: 1.19.0.
|
3
|
+
Version: 1.19.0.dev20250605
|
4
4
|
Summary: Flower: A Friendly Federated AI Framework
|
5
5
|
License: Apache-2.0
|
6
6
|
Keywords: Artificial Intelligence,Federated AI,Federated Analytics,Federated Evaluation,Federated Learning,Flower,Machine Learning
|
{flwr_nightly-1.19.0.dev20250604.dist-info → flwr_nightly-1.19.0.dev20250605.dist-info}/RECORD
RENAMED
@@ -84,7 +84,7 @@ flwr/client/grpc_adapter_client/__init__.py,sha256=RQWP5mFPROLHKgombiRvPXVWSoVrQ
|
|
84
84
|
flwr/client/grpc_adapter_client/connection.py,sha256=aj5tTYyE8z2hQLXPPydsJiz8gBDIWLUhfWvqYkAL1L4,3966
|
85
85
|
flwr/client/grpc_rere_client/__init__.py,sha256=i7iS0Lt8B7q0E2L72e4F_YrKm6ClRKnd71PNA6PW2O0,752
|
86
86
|
flwr/client/grpc_rere_client/client_interceptor.py,sha256=zFaVHw6AxeNO-7eCKKb-RxrPa7zbM5Z-2-1Efc4adQY,2451
|
87
|
-
flwr/client/grpc_rere_client/connection.py,sha256=
|
87
|
+
flwr/client/grpc_rere_client/connection.py,sha256=XwhT-yrWLHHegXpiAu1YuICLQ1t-KkOh6pNYJ9R4FEE,13358
|
88
88
|
flwr/client/grpc_rere_client/grpc_adapter.py,sha256=JvMZ7vCFTaTEo6AzKYh3zDmeQAU7VSjdysbC6t3ufWg,6351
|
89
89
|
flwr/client/message_handler/__init__.py,sha256=0lyljDVqre3WljiZbPcwCCf8GiIaSVI_yo_ylEyPwSE,719
|
90
90
|
flwr/client/message_handler/message_handler.py,sha256=X9SXX6et97Lw9_DGD93HKsEBGNjXClcFgc_5aLK0oiU,6541
|
@@ -125,7 +125,7 @@ flwr/common/heartbeat.py,sha256=SyEpNDnmJ0lni0cWO67rcoJVKasCLmkNHm3dKLeNrLU,5749
|
|
125
125
|
flwr/common/inflatable.py,sha256=9yPsSFOfNM2OIb15JQ6-wY5kblwXiC5zNX-tsp2ZwW0,7017
|
126
126
|
flwr/common/inflatable_grpc_utils.py,sha256=YGP8oJRfnkwvY6segWH1DUf_ljDIkku7-2zH66tv3HA,4337
|
127
127
|
flwr/common/logger.py,sha256=JbRf6E2vQxXzpDBq1T8IDUJo_usu3gjWEBPQ6uKcmdg,13049
|
128
|
-
flwr/common/message.py,sha256=
|
128
|
+
flwr/common/message.py,sha256=ZdH35PznYhIzfNKPzHTL1YS5z-flTpHnjdNpQR6B8x0,19953
|
129
129
|
flwr/common/object_ref.py,sha256=p3SfTeqo3Aj16SkB-vsnNn01zswOPdGNBitcbRnqmUk,9134
|
130
130
|
flwr/common/parameter.py,sha256=UVw6sOgehEFhFs4uUCMl2kfVq1PD6ncmWgPLMsZPKPE,2095
|
131
131
|
flwr/common/pyproject.py,sha256=2SU6yJW7059SbMXgzjOdK1GZRWO6AixDH7BmdxbMvHI,1386
|
@@ -229,14 +229,14 @@ flwr/server/client_manager.py,sha256=5jCGavVli7XdupvWWo7ru3PdFTlRU8IGvHFSSoUVLRs
|
|
229
229
|
flwr/server/client_proxy.py,sha256=sv0E9AldBYOvc3pusqFh-GnyreeMfsXQ1cuTtxTq_wY,2399
|
230
230
|
flwr/server/compat/__init__.py,sha256=0IsttWvY15qO98_1GyzVC-vR1e_ZPXOdu2qUlOkYMPE,886
|
231
231
|
flwr/server/compat/app.py,sha256=N18vG9fF6rnDQqzPGH53sdAi2P72QNAM1chtq9KQweQ,3323
|
232
|
-
flwr/server/compat/app_utils.py,sha256=
|
232
|
+
flwr/server/compat/app_utils.py,sha256=Uz6m-NV90cQ6k-gW6wlWQuhoFoK78qlMr0CEmALKXqY,4591
|
233
233
|
flwr/server/compat/grid_client_proxy.py,sha256=FxMgGtrzBoBAPby2ZjTWzpCJsCht8FwMm4PzqW80dmQ,4956
|
234
234
|
flwr/server/compat/legacy_context.py,sha256=94JsRQxyOdLI6lZZkFjS3-TMd0YJGAgSBBO0M_s_9ts,1804
|
235
235
|
flwr/server/criterion.py,sha256=G4e-6B48Pc7d5rmGVUpIzNKb6UF88O3VmTRuUltgjzM,1061
|
236
236
|
flwr/server/fleet_event_log_interceptor.py,sha256=AkL7Y5d3xm2vRhL3ahmEVVoOvAP7PA7dRgB-je4v-Ys,3774
|
237
237
|
flwr/server/grid/__init__.py,sha256=aWZHezoR2UGMJISB_gPMCm2N_2GSbm97A3lAp7ruhRQ,888
|
238
238
|
flwr/server/grid/grid.py,sha256=naGCYt5J6dnmUvrcGkdNyKPe3MBd-0awGm1ALmgahqY,6625
|
239
|
-
flwr/server/grid/grpc_grid.py,sha256=
|
239
|
+
flwr/server/grid/grpc_grid.py,sha256=ymLaqWYYkv0uWrYvxavMKEyB0TVRMSPi1tJhmvhe7_g,12392
|
240
240
|
flwr/server/grid/inmemory_grid.py,sha256=RjejYT-d-hHuTs1KSs_5wvOdAWKLus8w5_UAcnGt4iw,6168
|
241
241
|
flwr/server/history.py,sha256=cCkFhBN4GoHsYYNk5GG1Y089eKJh2DH_ZJbYPwLaGyk,5026
|
242
242
|
flwr/server/run_serverapp.py,sha256=v0p6jXj2dFxlRUdoEeF1mnaFd9XRQi6dZCflPY6d3qI,2063
|
@@ -357,7 +357,7 @@ flwr/supernode/servicer/__init__.py,sha256=lucTzre5WPK7G1YLCfaqg3rbFWdNSb7ZTt-ca
|
|
357
357
|
flwr/supernode/servicer/clientappio/__init__.py,sha256=vJyOjO2FXZ2URbnthmdsgs6948wbYfdq1L1V8Um-Lr8,895
|
358
358
|
flwr/supernode/servicer/clientappio/clientappio_servicer.py,sha256=LmzkxtNQBn5vVrHc0Bhq2WqaK6-LM2v4kfLBN0PiNNM,8522
|
359
359
|
flwr/supernode/start_client_internal.py,sha256=5CwTNV-XmIhwR1jv3G7aQAXGhf6OFWS6U-vmxY1iKGA,16984
|
360
|
-
flwr_nightly-1.19.0.
|
361
|
-
flwr_nightly-1.19.0.
|
362
|
-
flwr_nightly-1.19.0.
|
363
|
-
flwr_nightly-1.19.0.
|
360
|
+
flwr_nightly-1.19.0.dev20250605.dist-info/METADATA,sha256=gsyzTuVl8GpQD7gk1RPBCbNvdugpyl08gCr1sC0kUHc,15910
|
361
|
+
flwr_nightly-1.19.0.dev20250605.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
362
|
+
flwr_nightly-1.19.0.dev20250605.dist-info/entry_points.txt,sha256=jNpDXGBGgs21RqUxelF_jwGaxtqFwm-MQyfz-ZqSjrA,367
|
363
|
+
flwr_nightly-1.19.0.dev20250605.dist-info/RECORD,,
|
{flwr_nightly-1.19.0.dev20250604.dist-info → flwr_nightly-1.19.0.dev20250605.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|