flwr 1.15.2__py3-none-any.whl → 1.17.0__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/cli/build.py +2 -0
- flwr/cli/log.py +20 -21
- flwr/cli/new/templates/app/code/flwr_tune/client_app.py.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.baseline.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.flowertune.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.huggingface.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.jax.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.mlx.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.numpy.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.pytorch.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.sklearn.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.tensorflow.toml.tpl +1 -1
- flwr/cli/run/run.py +5 -9
- flwr/client/app.py +6 -4
- flwr/client/client_app.py +260 -86
- flwr/client/clientapp/app.py +6 -2
- flwr/client/grpc_client/connection.py +24 -21
- flwr/client/message_handler/message_handler.py +28 -28
- flwr/client/mod/__init__.py +2 -2
- flwr/client/mod/centraldp_mods.py +7 -7
- flwr/client/mod/comms_mods.py +16 -22
- flwr/client/mod/localdp_mod.py +4 -4
- flwr/client/mod/secure_aggregation/secaggplus_mod.py +31 -31
- flwr/client/rest_client/connection.py +4 -6
- flwr/client/run_info_store.py +2 -2
- flwr/client/supernode/__init__.py +0 -2
- flwr/client/supernode/app.py +1 -11
- flwr/common/__init__.py +12 -4
- flwr/common/address.py +35 -0
- flwr/common/args.py +8 -2
- flwr/common/auth_plugin/auth_plugin.py +2 -1
- flwr/common/config.py +4 -4
- flwr/common/constant.py +16 -0
- flwr/common/context.py +4 -4
- flwr/common/event_log_plugin/__init__.py +22 -0
- flwr/common/event_log_plugin/event_log_plugin.py +60 -0
- flwr/common/grpc.py +1 -1
- flwr/common/logger.py +2 -2
- flwr/common/message.py +338 -102
- flwr/common/object_ref.py +0 -10
- flwr/common/record/__init__.py +8 -4
- flwr/common/record/arrayrecord.py +626 -0
- flwr/common/record/{configsrecord.py → configrecord.py} +75 -29
- flwr/common/record/conversion_utils.py +9 -18
- flwr/common/record/{metricsrecord.py → metricrecord.py} +78 -32
- flwr/common/record/recorddict.py +288 -0
- flwr/common/recorddict_compat.py +410 -0
- flwr/common/secure_aggregation/quantization.py +5 -1
- flwr/common/secure_aggregation/secaggplus_constants.py +1 -1
- flwr/common/serde.py +67 -190
- flwr/common/telemetry.py +0 -10
- flwr/common/typing.py +44 -8
- flwr/proto/exec_pb2.py +3 -3
- flwr/proto/exec_pb2.pyi +3 -3
- flwr/proto/message_pb2.py +12 -12
- flwr/proto/message_pb2.pyi +9 -9
- flwr/proto/recorddict_pb2.py +70 -0
- flwr/proto/{recordset_pb2.pyi → recorddict_pb2.pyi} +35 -35
- flwr/proto/run_pb2.py +31 -31
- flwr/proto/run_pb2.pyi +3 -3
- flwr/server/__init__.py +3 -1
- flwr/server/app.py +74 -3
- flwr/server/compat/__init__.py +2 -2
- flwr/server/compat/app.py +15 -12
- flwr/server/compat/app_utils.py +26 -18
- flwr/server/compat/{driver_client_proxy.py → grid_client_proxy.py} +41 -41
- flwr/server/fleet_event_log_interceptor.py +94 -0
- flwr/server/{driver → grid}/__init__.py +8 -7
- flwr/server/{driver/driver.py → grid/grid.py} +48 -19
- flwr/server/{driver/grpc_driver.py → grid/grpc_grid.py} +88 -56
- flwr/server/{driver/inmemory_driver.py → grid/inmemory_grid.py} +41 -54
- flwr/server/run_serverapp.py +6 -17
- flwr/server/server_app.py +126 -33
- flwr/server/serverapp/app.py +10 -10
- flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py +2 -2
- flwr/server/superlink/fleet/message_handler/message_handler.py +8 -12
- flwr/server/superlink/fleet/vce/backend/backend.py +3 -3
- flwr/server/superlink/fleet/vce/backend/raybackend.py +2 -2
- flwr/server/superlink/fleet/vce/vce_api.py +33 -38
- flwr/server/superlink/linkstate/in_memory_linkstate.py +171 -132
- flwr/server/superlink/linkstate/linkstate.py +51 -64
- flwr/server/superlink/linkstate/sqlite_linkstate.py +253 -285
- flwr/server/superlink/linkstate/utils.py +171 -133
- flwr/server/superlink/{driver → serverappio}/__init__.py +1 -1
- flwr/server/superlink/{driver → serverappio}/serverappio_grpc.py +1 -1
- flwr/server/superlink/{driver → serverappio}/serverappio_servicer.py +27 -29
- flwr/server/superlink/simulation/simulationio_servicer.py +2 -2
- flwr/server/typing.py +3 -3
- flwr/server/utils/__init__.py +2 -2
- flwr/server/utils/validator.py +53 -68
- flwr/server/workflow/default_workflows.py +52 -58
- flwr/server/workflow/secure_aggregation/secaggplus_workflow.py +48 -50
- flwr/simulation/app.py +2 -2
- flwr/simulation/ray_transport/ray_actor.py +4 -2
- flwr/simulation/ray_transport/ray_client_proxy.py +34 -32
- flwr/simulation/run_simulation.py +15 -15
- flwr/superexec/app.py +0 -14
- flwr/superexec/deployment.py +4 -4
- flwr/superexec/exec_event_log_interceptor.py +135 -0
- flwr/superexec/exec_grpc.py +10 -4
- flwr/superexec/exec_servicer.py +6 -6
- flwr/superexec/exec_user_auth_interceptor.py +22 -4
- flwr/superexec/executor.py +3 -3
- flwr/superexec/simulation.py +3 -3
- {flwr-1.15.2.dist-info → flwr-1.17.0.dist-info}/METADATA +5 -5
- {flwr-1.15.2.dist-info → flwr-1.17.0.dist-info}/RECORD +111 -112
- {flwr-1.15.2.dist-info → flwr-1.17.0.dist-info}/entry_points.txt +0 -3
- flwr/client/message_handler/task_handler.py +0 -37
- flwr/common/record/parametersrecord.py +0 -204
- flwr/common/record/recordset.py +0 -202
- flwr/common/recordset_compat.py +0 -418
- flwr/proto/recordset_pb2.py +0 -70
- flwr/proto/task_pb2.py +0 -33
- flwr/proto/task_pb2.pyi +0 -100
- flwr/proto/task_pb2_grpc.py +0 -4
- flwr/proto/task_pb2_grpc.pyi +0 -4
- /flwr/proto/{recordset_pb2_grpc.py → recorddict_pb2_grpc.py} +0 -0
- /flwr/proto/{recordset_pb2_grpc.pyi → recorddict_pb2_grpc.pyi} +0 -0
- {flwr-1.15.2.dist-info → flwr-1.17.0.dist-info}/LICENSE +0 -0
- {flwr-1.15.2.dist-info → flwr-1.17.0.dist-info}/WHEEL +0 -0
|
@@ -19,126 +19,113 @@ import abc
|
|
|
19
19
|
from typing import Optional
|
|
20
20
|
from uuid import UUID
|
|
21
21
|
|
|
22
|
-
from flwr.common import Context
|
|
23
|
-
from flwr.common.record import
|
|
22
|
+
from flwr.common import Context, Message
|
|
23
|
+
from flwr.common.record import ConfigRecord
|
|
24
24
|
from flwr.common.typing import Run, RunStatus, UserConfig
|
|
25
|
-
from flwr.proto.task_pb2 import TaskIns, TaskRes # pylint: disable=E0611
|
|
26
25
|
|
|
27
26
|
|
|
28
27
|
class LinkState(abc.ABC): # pylint: disable=R0904
|
|
29
28
|
"""Abstract LinkState."""
|
|
30
29
|
|
|
31
30
|
@abc.abstractmethod
|
|
32
|
-
def
|
|
33
|
-
"""Store one
|
|
31
|
+
def store_message_ins(self, message: Message) -> Optional[UUID]:
|
|
32
|
+
"""Store one Message.
|
|
34
33
|
|
|
35
34
|
Usually, the ServerAppIo API calls this to schedule instructions.
|
|
36
35
|
|
|
37
|
-
Stores the value of the `
|
|
38
|
-
returns the `
|
|
39
|
-
storing the `
|
|
36
|
+
Stores the value of the `message` in the link state and, if successful,
|
|
37
|
+
returns the `message_id` (UUID) of the `message`. If, for any reason,
|
|
38
|
+
storing the `message` fails, `None` is returned.
|
|
40
39
|
|
|
41
40
|
Constraints
|
|
42
41
|
-----------
|
|
43
|
-
`
|
|
42
|
+
`message.metadata.dst_node_id` MUST be set (not constant.SUPERLINK_NODE_ID)
|
|
44
43
|
|
|
45
|
-
If `
|
|
46
|
-
storing the `
|
|
44
|
+
If `message.metadata.run_id` is invalid, then
|
|
45
|
+
storing the `message` MUST fail.
|
|
47
46
|
"""
|
|
48
47
|
|
|
49
48
|
@abc.abstractmethod
|
|
50
|
-
def
|
|
51
|
-
"""Get
|
|
49
|
+
def get_message_ins(self, node_id: int, limit: Optional[int]) -> list[Message]:
|
|
50
|
+
"""Get zero or more `Message` objects for the provided `node_id`.
|
|
52
51
|
|
|
53
52
|
Usually, the Fleet API calls this for Nodes planning to work on one or more
|
|
54
|
-
|
|
53
|
+
Message.
|
|
55
54
|
|
|
56
55
|
Constraints
|
|
57
56
|
-----------
|
|
58
|
-
Retrieve all
|
|
57
|
+
Retrieve all Message where the `message.metadata.dst_node_id` equals `node_id`.
|
|
59
58
|
|
|
60
|
-
|
|
61
|
-
2. the `task_ins.task.delivered_at` equals `""`.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
If `delivered_at` MUST BE set (not `""`) otherwise the TaskIns MUST not be in
|
|
65
|
-
the result.
|
|
66
|
-
|
|
67
|
-
If `limit` is not `None`, return, at most, `limit` number of `task_ins`. If
|
|
59
|
+
If `limit` is not `None`, return, at most, `limit` number of `message`. If
|
|
68
60
|
`limit` is set, it has to be greater zero.
|
|
69
61
|
"""
|
|
70
62
|
|
|
71
63
|
@abc.abstractmethod
|
|
72
|
-
def
|
|
73
|
-
"""Store one
|
|
64
|
+
def store_message_res(self, message: Message) -> Optional[UUID]:
|
|
65
|
+
"""Store one Message.
|
|
74
66
|
|
|
75
67
|
Usually, the Fleet API calls this for Nodes returning results.
|
|
76
68
|
|
|
77
|
-
Stores the
|
|
78
|
-
the `
|
|
69
|
+
Stores the Message and, if successful, returns the `message_id` (UUID) of
|
|
70
|
+
the `message`. If storing the `message` fails, `None` is returned.
|
|
79
71
|
|
|
80
72
|
Constraints
|
|
81
73
|
-----------
|
|
74
|
+
`message.metadata.dst_node_id` MUST be set (not constant.SUPERLINK_NODE_ID)
|
|
82
75
|
|
|
83
|
-
`
|
|
84
|
-
|
|
85
|
-
If `task_res.run_id` is invalid, then
|
|
86
|
-
storing the `task_res` MUST fail.
|
|
76
|
+
If `message.metadata.run_id` is invalid, then
|
|
77
|
+
storing the `message` MUST fail.
|
|
87
78
|
"""
|
|
88
79
|
|
|
89
80
|
@abc.abstractmethod
|
|
90
|
-
def
|
|
91
|
-
"""Get
|
|
81
|
+
def get_message_res(self, message_ids: set[UUID]) -> list[Message]:
|
|
82
|
+
"""Get reply Messages for the given Message IDs.
|
|
92
83
|
|
|
93
84
|
This method is typically called by the ServerAppIo API to obtain
|
|
94
|
-
results (
|
|
95
|
-
For each
|
|
85
|
+
results (type Message) for previously scheduled instructions (type Message).
|
|
86
|
+
For each message_id passed, this method returns one of the following responses:
|
|
96
87
|
|
|
97
|
-
- An error
|
|
98
|
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
88
|
+
- An error Message if there was no message registered with such message IDs
|
|
89
|
+
or has expired.
|
|
90
|
+
- An error Message if the reply Message exists but has expired.
|
|
91
|
+
- The reply Message.
|
|
92
|
+
- Nothing if the Message with the passed message_id is still valid and waiting
|
|
93
|
+
for a reply Message.
|
|
101
94
|
|
|
102
95
|
Parameters
|
|
103
96
|
----------
|
|
104
|
-
|
|
105
|
-
A set of
|
|
97
|
+
message_ids : set[UUID]
|
|
98
|
+
A set of Message IDs used to retrieve reply Messages responding to them.
|
|
106
99
|
|
|
107
100
|
Returns
|
|
108
101
|
-------
|
|
109
|
-
list[
|
|
110
|
-
A list of
|
|
111
|
-
|
|
102
|
+
list[Message]
|
|
103
|
+
A list of reply Message responding to the given message IDs or Messages
|
|
104
|
+
carrying an Error.
|
|
112
105
|
"""
|
|
113
106
|
|
|
114
107
|
@abc.abstractmethod
|
|
115
|
-
def
|
|
116
|
-
"""Calculate the number of
|
|
117
|
-
|
|
118
|
-
This includes delivered but not yet deleted task_ins.
|
|
119
|
-
"""
|
|
108
|
+
def num_message_ins(self) -> int:
|
|
109
|
+
"""Calculate the number of Messages awaiting a reply."""
|
|
120
110
|
|
|
121
111
|
@abc.abstractmethod
|
|
122
|
-
def
|
|
123
|
-
"""Calculate the number of
|
|
124
|
-
|
|
125
|
-
This includes delivered but not yet deleted task_res.
|
|
126
|
-
"""
|
|
112
|
+
def num_message_res(self) -> int:
|
|
113
|
+
"""Calculate the number of reply Messages in store."""
|
|
127
114
|
|
|
128
115
|
@abc.abstractmethod
|
|
129
|
-
def
|
|
130
|
-
"""Delete
|
|
116
|
+
def delete_messages(self, message_ins_ids: set[UUID]) -> None:
|
|
117
|
+
"""Delete a Message and its reply based on provided Message IDs.
|
|
131
118
|
|
|
132
119
|
Parameters
|
|
133
120
|
----------
|
|
134
|
-
|
|
135
|
-
A set of
|
|
136
|
-
|
|
121
|
+
message_ins_ids : set[UUID]
|
|
122
|
+
A set of Message IDs. For each ID in the set, the corresponding
|
|
123
|
+
Message and its associated reply Message will be deleted.
|
|
137
124
|
"""
|
|
138
125
|
|
|
139
126
|
@abc.abstractmethod
|
|
140
|
-
def
|
|
141
|
-
"""Get all
|
|
127
|
+
def get_message_ids_from_run_id(self, run_id: int) -> set[UUID]:
|
|
128
|
+
"""Get all instruction Message IDs for the given run_id."""
|
|
142
129
|
|
|
143
130
|
@abc.abstractmethod
|
|
144
131
|
def create_node(self, ping_interval: float) -> int:
|
|
@@ -177,7 +164,7 @@ class LinkState(abc.ABC): # pylint: disable=R0904
|
|
|
177
164
|
fab_version: Optional[str],
|
|
178
165
|
fab_hash: Optional[str],
|
|
179
166
|
override_config: UserConfig,
|
|
180
|
-
federation_options:
|
|
167
|
+
federation_options: ConfigRecord,
|
|
181
168
|
) -> int:
|
|
182
169
|
"""Create a new run for the specified `fab_hash`."""
|
|
183
170
|
|
|
@@ -249,7 +236,7 @@ class LinkState(abc.ABC): # pylint: disable=R0904
|
|
|
249
236
|
"""
|
|
250
237
|
|
|
251
238
|
@abc.abstractmethod
|
|
252
|
-
def get_federation_options(self, run_id: int) -> Optional[
|
|
239
|
+
def get_federation_options(self, run_id: int) -> Optional[ConfigRecord]:
|
|
253
240
|
"""Retrieve the federation options for the specified `run_id`.
|
|
254
241
|
|
|
255
242
|
Parameters
|
|
@@ -259,7 +246,7 @@ class LinkState(abc.ABC): # pylint: disable=R0904
|
|
|
259
246
|
|
|
260
247
|
Returns
|
|
261
248
|
-------
|
|
262
|
-
Optional[
|
|
249
|
+
Optional[ConfigRecord]
|
|
263
250
|
The federation options for the run if it exists; None otherwise.
|
|
264
251
|
"""
|
|
265
252
|
|