flwr 1.16.0__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/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 +162 -99
- flwr/client/clientapp/app.py +2 -2
- flwr/client/grpc_client/connection.py +24 -21
- flwr/client/message_handler/message_handler.py +27 -27
- 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/run_info_store.py +2 -2
- flwr/common/__init__.py +12 -4
- flwr/common/config.py +4 -4
- flwr/common/constant.py +6 -6
- flwr/common/context.py +4 -4
- flwr/common/event_log_plugin/event_log_plugin.py +3 -3
- flwr/common/logger.py +2 -2
- flwr/common/message.py +327 -102
- 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 +1 -1
- 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/secaggplus_constants.py +1 -1
- flwr/common/serde.py +66 -71
- flwr/common/typing.py +8 -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 +56 -1
- flwr/server/compat/__init__.py +2 -2
- flwr/server/compat/app.py +11 -11
- flwr/server/compat/app_utils.py +16 -16
- flwr/server/compat/{driver_client_proxy.py → grid_client_proxy.py} +39 -39
- 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} +47 -18
- flwr/server/{driver/grpc_driver.py → grid/grpc_grid.py} +87 -64
- flwr/server/{driver/inmemory_driver.py → grid/inmemory_grid.py} +24 -34
- flwr/server/run_serverapp.py +4 -4
- flwr/server/server_app.py +38 -18
- flwr/server/serverapp/app.py +10 -10
- flwr/server/superlink/fleet/vce/backend/backend.py +2 -2
- flwr/server/superlink/fleet/vce/backend/raybackend.py +2 -2
- flwr/server/superlink/fleet/vce/vce_api.py +1 -3
- flwr/server/superlink/linkstate/in_memory_linkstate.py +33 -8
- flwr/server/superlink/linkstate/linkstate.py +4 -4
- flwr/server/superlink/linkstate/sqlite_linkstate.py +61 -27
- flwr/server/superlink/linkstate/utils.py +93 -27
- 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 +4 -4
- flwr/server/superlink/simulation/simulationio_servicer.py +2 -2
- flwr/server/typing.py +3 -3
- flwr/server/utils/validator.py +4 -4
- flwr/server/workflow/default_workflows.py +48 -57
- 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/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 +2 -2
- flwr/superexec/exec_user_auth_interceptor.py +18 -2
- flwr/superexec/executor.py +3 -3
- flwr/superexec/simulation.py +3 -3
- {flwr-1.16.0.dist-info → flwr-1.17.0.dist-info}/METADATA +2 -2
- {flwr-1.16.0.dist-info → flwr-1.17.0.dist-info}/RECORD +94 -92
- flwr/common/record/parametersrecord.py +0 -339
- flwr/common/record/recordset.py +0 -209
- flwr/common/recordset_compat.py +0 -418
- flwr/proto/recordset_pb2.py +0 -70
- /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.16.0.dist-info → flwr-1.17.0.dist-info}/LICENSE +0 -0
- {flwr-1.16.0.dist-info → flwr-1.17.0.dist-info}/WHEEL +0 -0
- {flwr-1.16.0.dist-info → flwr-1.17.0.dist-info}/entry_points.txt +0 -0
flwr/common/__init__.py
CHANGED
|
@@ -31,9 +31,13 @@ from .parameter import ndarray_to_bytes as ndarray_to_bytes
|
|
|
31
31
|
from .parameter import ndarrays_to_parameters as ndarrays_to_parameters
|
|
32
32
|
from .parameter import parameters_to_ndarrays as parameters_to_ndarrays
|
|
33
33
|
from .record import Array as Array
|
|
34
|
+
from .record import ArrayRecord as ArrayRecord
|
|
35
|
+
from .record import ConfigRecord as ConfigRecord
|
|
34
36
|
from .record import ConfigsRecord as ConfigsRecord
|
|
37
|
+
from .record import MetricRecord as MetricRecord
|
|
35
38
|
from .record import MetricsRecord as MetricsRecord
|
|
36
39
|
from .record import ParametersRecord as ParametersRecord
|
|
40
|
+
from .record import RecordDict as RecordDict
|
|
37
41
|
from .record import RecordSet as RecordSet
|
|
38
42
|
from .record import array_from_numpy as array_from_numpy
|
|
39
43
|
from .telemetry import EventType as EventType
|
|
@@ -41,7 +45,7 @@ from .telemetry import event as event
|
|
|
41
45
|
from .typing import ClientMessage as ClientMessage
|
|
42
46
|
from .typing import Code as Code
|
|
43
47
|
from .typing import Config as Config
|
|
44
|
-
from .typing import
|
|
48
|
+
from .typing import ConfigRecordValues as ConfigRecordValues
|
|
45
49
|
from .typing import DisconnectRes as DisconnectRes
|
|
46
50
|
from .typing import EvaluateIns as EvaluateIns
|
|
47
51
|
from .typing import EvaluateRes as EvaluateRes
|
|
@@ -51,9 +55,9 @@ from .typing import GetParametersIns as GetParametersIns
|
|
|
51
55
|
from .typing import GetParametersRes as GetParametersRes
|
|
52
56
|
from .typing import GetPropertiesIns as GetPropertiesIns
|
|
53
57
|
from .typing import GetPropertiesRes as GetPropertiesRes
|
|
58
|
+
from .typing import MetricRecordValues as MetricRecordValues
|
|
54
59
|
from .typing import Metrics as Metrics
|
|
55
60
|
from .typing import MetricsAggregationFn as MetricsAggregationFn
|
|
56
|
-
from .typing import MetricsRecordValues as MetricsRecordValues
|
|
57
61
|
from .typing import NDArray as NDArray
|
|
58
62
|
from .typing import NDArrays as NDArrays
|
|
59
63
|
from .typing import Parameters as Parameters
|
|
@@ -65,11 +69,13 @@ from .typing import Status as Status
|
|
|
65
69
|
|
|
66
70
|
__all__ = [
|
|
67
71
|
"Array",
|
|
72
|
+
"ArrayRecord",
|
|
68
73
|
"ClientMessage",
|
|
69
74
|
"Code",
|
|
70
75
|
"Config",
|
|
76
|
+
"ConfigRecord",
|
|
77
|
+
"ConfigRecordValues",
|
|
71
78
|
"ConfigsRecord",
|
|
72
|
-
"ConfigsRecordValues",
|
|
73
79
|
"Context",
|
|
74
80
|
"DEFAULT_TTL",
|
|
75
81
|
"DisconnectRes",
|
|
@@ -88,16 +94,18 @@ __all__ = [
|
|
|
88
94
|
"MessageType",
|
|
89
95
|
"MessageTypeLegacy",
|
|
90
96
|
"Metadata",
|
|
97
|
+
"MetricRecord",
|
|
98
|
+
"MetricRecordValues",
|
|
91
99
|
"Metrics",
|
|
92
100
|
"MetricsAggregationFn",
|
|
93
101
|
"MetricsRecord",
|
|
94
|
-
"MetricsRecordValues",
|
|
95
102
|
"NDArray",
|
|
96
103
|
"NDArrays",
|
|
97
104
|
"Parameters",
|
|
98
105
|
"ParametersRecord",
|
|
99
106
|
"Properties",
|
|
100
107
|
"ReconnectIns",
|
|
108
|
+
"RecordDict",
|
|
101
109
|
"RecordSet",
|
|
102
110
|
"Scalar",
|
|
103
111
|
"ServerMessage",
|
flwr/common/config.py
CHANGED
|
@@ -34,7 +34,7 @@ from flwr.common.constant import (
|
|
|
34
34
|
)
|
|
35
35
|
from flwr.common.typing import Run, UserConfig, UserConfigValue
|
|
36
36
|
|
|
37
|
-
from . import
|
|
37
|
+
from . import ConfigRecord, object_ref
|
|
38
38
|
|
|
39
39
|
T_dict = TypeVar("T_dict", bound=dict[str, Any]) # pylint: disable=invalid-name
|
|
40
40
|
|
|
@@ -260,9 +260,9 @@ def get_metadata_from_config(config: dict[str, Any]) -> tuple[str, str]:
|
|
|
260
260
|
)
|
|
261
261
|
|
|
262
262
|
|
|
263
|
-
def
|
|
264
|
-
"""Construct a `
|
|
265
|
-
c_record =
|
|
263
|
+
def user_config_to_configrecord(config: UserConfig) -> ConfigRecord:
|
|
264
|
+
"""Construct a `ConfigRecord` out of a `UserConfig`."""
|
|
265
|
+
c_record = ConfigRecord()
|
|
266
266
|
for k, v in config.items():
|
|
267
267
|
c_record[k] = v
|
|
268
268
|
|
flwr/common/constant.py
CHANGED
|
@@ -61,6 +61,7 @@ PING_CALL_TIMEOUT = 5
|
|
|
61
61
|
PING_BASE_MULTIPLIER = 0.8
|
|
62
62
|
PING_RANDOM_RANGE = (-0.1, 0.1)
|
|
63
63
|
PING_MAX_INTERVAL = 1e300
|
|
64
|
+
PING_PATIENCE = 2
|
|
64
65
|
|
|
65
66
|
# IDs
|
|
66
67
|
RUN_ID_NUM_BYTES = 8
|
|
@@ -120,6 +121,9 @@ TIMESTAMP_HEADER = "flwr-timestamp"
|
|
|
120
121
|
TIMESTAMP_TOLERANCE = 10 # General tolerance for timestamp verification
|
|
121
122
|
SYSTEM_TIME_TOLERANCE = 5 # Allowance for system time drift
|
|
122
123
|
|
|
124
|
+
# Constants for ArrayRecord
|
|
125
|
+
GC_THRESHOLD = 200_000_000 # 200 MB
|
|
126
|
+
|
|
123
127
|
|
|
124
128
|
class MessageType:
|
|
125
129
|
"""Message type."""
|
|
@@ -127,6 +131,7 @@ class MessageType:
|
|
|
127
131
|
TRAIN = "train"
|
|
128
132
|
EVALUATE = "evaluate"
|
|
129
133
|
QUERY = "query"
|
|
134
|
+
SYSTEM = "system"
|
|
130
135
|
|
|
131
136
|
def __new__(cls) -> MessageType:
|
|
132
137
|
"""Prevent instantiation."""
|
|
@@ -162,6 +167,7 @@ class ErrorCode:
|
|
|
162
167
|
CLIENT_APP_RAISED_EXCEPTION = 2
|
|
163
168
|
MESSAGE_UNAVAILABLE = 3
|
|
164
169
|
REPLY_MESSAGE_UNAVAILABLE = 4
|
|
170
|
+
NODE_UNAVAILABLE = 5
|
|
165
171
|
|
|
166
172
|
def __new__(cls) -> ErrorCode:
|
|
167
173
|
"""Prevent instantiation."""
|
|
@@ -217,14 +223,8 @@ class AuthType:
|
|
|
217
223
|
class EventLogWriterType:
|
|
218
224
|
"""Event log writer types."""
|
|
219
225
|
|
|
220
|
-
FALSE = "false"
|
|
221
226
|
STDOUT = "stdout"
|
|
222
227
|
|
|
223
228
|
def __new__(cls) -> EventLogWriterType:
|
|
224
229
|
"""Prevent instantiation."""
|
|
225
230
|
raise TypeError(f"{cls.__name__} cannot be instantiated.")
|
|
226
|
-
|
|
227
|
-
@classmethod
|
|
228
|
-
def choices(cls) -> list[str]:
|
|
229
|
-
"""Return a list of available log writer choices."""
|
|
230
|
-
return [cls.FALSE, cls.STDOUT]
|
flwr/common/context.py
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
from dataclasses import dataclass
|
|
19
19
|
|
|
20
|
-
from .record import
|
|
20
|
+
from .record import RecordDict
|
|
21
21
|
from .typing import UserConfig
|
|
22
22
|
|
|
23
23
|
|
|
@@ -34,7 +34,7 @@ class Context:
|
|
|
34
34
|
node_config : UserConfig
|
|
35
35
|
A config (key/value mapping) unique to the node and independent of the
|
|
36
36
|
`run_config`. This config persists across all runs this node participates in.
|
|
37
|
-
state :
|
|
37
|
+
state : RecordDict
|
|
38
38
|
Holds records added by the entity in a given `run_id` and that will stay local.
|
|
39
39
|
This means that the data it holds will never leave the system it's running from.
|
|
40
40
|
This can be used as an intermediate storage or scratchpad when
|
|
@@ -50,7 +50,7 @@ class Context:
|
|
|
50
50
|
run_id: int
|
|
51
51
|
node_id: int
|
|
52
52
|
node_config: UserConfig
|
|
53
|
-
state:
|
|
53
|
+
state: RecordDict
|
|
54
54
|
run_config: UserConfig
|
|
55
55
|
|
|
56
56
|
def __init__( # pylint: disable=too-many-arguments, too-many-positional-arguments
|
|
@@ -58,7 +58,7 @@ class Context:
|
|
|
58
58
|
run_id: int,
|
|
59
59
|
node_id: int,
|
|
60
60
|
node_config: UserConfig,
|
|
61
|
-
state:
|
|
61
|
+
state: RecordDict,
|
|
62
62
|
run_config: UserConfig,
|
|
63
63
|
) -> None:
|
|
64
64
|
self.run_id = run_id
|
|
@@ -36,7 +36,7 @@ class EventLogWriterPlugin(ABC):
|
|
|
36
36
|
self,
|
|
37
37
|
request: GrpcMessage,
|
|
38
38
|
context: grpc.ServicerContext,
|
|
39
|
-
user_info: UserInfo,
|
|
39
|
+
user_info: Optional[UserInfo],
|
|
40
40
|
method_name: str,
|
|
41
41
|
) -> LogEntry:
|
|
42
42
|
"""Compose pre-event log entry from the provided request and context."""
|
|
@@ -46,9 +46,9 @@ class EventLogWriterPlugin(ABC):
|
|
|
46
46
|
self,
|
|
47
47
|
request: GrpcMessage,
|
|
48
48
|
context: grpc.ServicerContext,
|
|
49
|
-
user_info: UserInfo,
|
|
49
|
+
user_info: Optional[UserInfo],
|
|
50
50
|
method_name: str,
|
|
51
|
-
response: Optional[Union[GrpcMessage,
|
|
51
|
+
response: Optional[Union[GrpcMessage, BaseException]],
|
|
52
52
|
) -> LogEntry:
|
|
53
53
|
"""Compose post-event log entry from the provided response and context."""
|
|
54
54
|
|
flwr/common/logger.py
CHANGED
|
@@ -250,9 +250,9 @@ def warn_deprecated_feature_with_example(
|
|
|
250
250
|
log(
|
|
251
251
|
WARN,
|
|
252
252
|
"""FEATURE UPDATE: %s
|
|
253
|
-
|
|
253
|
+
------------------------------------------------------------
|
|
254
254
|
%s
|
|
255
|
-
|
|
255
|
+
------------------------------------------------------------
|
|
256
256
|
""",
|
|
257
257
|
example_message,
|
|
258
258
|
code_example,
|