flwr-nightly 1.13.0.dev20241107__py3-none-any.whl → 1.13.0.dev20241109__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/common/object_ref.py CHANGED
@@ -153,21 +153,36 @@ def load_app( # pylint: disable= too-many-branches
153
153
  module_str, _, attributes_str = module_attribute_str.partition(":")
154
154
 
155
155
  try:
156
- if _current_sys_path:
157
- # Hack: `tabnet` does not work with reloading
158
- if "tabnet" in sys.modules:
159
- log(
160
- WARN,
161
- "Cannot reload module `%s` from disk due to compatibility issues "
162
- "with the `tabnet` library. The module will be loaded from the "
163
- "cache instead. If you experience issues, consider restarting "
164
- "the application.",
165
- module_str,
166
- )
167
- else:
168
- _unload_modules(Path(_current_sys_path))
156
+ # Initialize project path
157
+ if project_dir is None:
158
+ project_dir = Path.cwd()
159
+ project_dir = Path(project_dir).absolute()
160
+
161
+ # Unload modules if the project directory has changed
162
+ if _current_sys_path and _current_sys_path != str(project_dir):
163
+ _unload_modules(Path(_current_sys_path))
164
+
165
+ # Set the system path
169
166
  _set_sys_path(project_dir)
170
- module = importlib.import_module(module_str)
167
+
168
+ # Import the module
169
+ if module_str not in sys.modules:
170
+ module = importlib.import_module(module_str)
171
+ # Hack: `tabnet` does not work with `importlib.reload`
172
+ elif "tabnet" in sys.modules:
173
+ log(
174
+ WARN,
175
+ "Cannot reload module `%s` from disk due to compatibility issues "
176
+ "with the `tabnet` library. The module will be loaded from the "
177
+ "cache instead. If you experience issues, consider restarting "
178
+ "the application.",
179
+ module_str,
180
+ )
181
+ module = sys.modules[module_str]
182
+ else:
183
+ module = sys.modules[module_str]
184
+ _reload_modules(project_dir)
185
+
171
186
  except ModuleNotFoundError as err:
172
187
  raise error_type(
173
188
  f"Unable to load module {module_str}{OBJECT_REF_HELP_STR}",
@@ -196,6 +211,15 @@ def _unload_modules(project_dir: Path) -> None:
196
211
  del sys.modules[name]
197
212
 
198
213
 
214
+ def _reload_modules(project_dir: Path) -> None:
215
+ """Reload modules from the project directory."""
216
+ dir_str = str(project_dir.absolute())
217
+ for m in list(sys.modules.values()):
218
+ path: Optional[str] = getattr(m, "__file__", None)
219
+ if path is not None and path.startswith(dir_str):
220
+ importlib.reload(m)
221
+
222
+
199
223
  def _set_sys_path(directory: Optional[Union[str, Path]]) -> None:
200
224
  """Set the system path."""
201
225
  if directory is None:
flwr/common/typing.py CHANGED
@@ -24,7 +24,7 @@ import numpy.typing as npt
24
24
 
25
25
  NDArray = npt.NDArray[Any]
26
26
  NDArrayInt = npt.NDArray[np.int_]
27
- NDArrayFloat = npt.NDArray[np.float_]
27
+ NDArrayFloat = npt.NDArray[np.float64]
28
28
  NDArrays = list[NDArray]
29
29
 
30
30
  # The following union type contains Python types corresponding to ProtoBuf types that
flwr/proto/run_pb2.py CHANGED
@@ -14,10 +14,11 @@ _sym_db = _symbol_database.Default()
14
14
 
15
15
  from flwr.proto import fab_pb2 as flwr_dot_proto_dot_fab__pb2
16
16
  from flwr.proto import node_pb2 as flwr_dot_proto_dot_node__pb2
17
+ from flwr.proto import recordset_pb2 as flwr_dot_proto_dot_recordset__pb2
17
18
  from flwr.proto import transport_pb2 as flwr_dot_proto_dot_transport__pb2
18
19
 
19
20
 
20
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14\x66lwr/proto/run.proto\x12\nflwr.proto\x1a\x14\x66lwr/proto/fab.proto\x1a\x15\x66lwr/proto/node.proto\x1a\x1a\x66lwr/proto/transport.proto\"\xd5\x01\n\x03Run\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\x12\x0e\n\x06\x66\x61\x62_id\x18\x02 \x01(\t\x12\x13\n\x0b\x66\x61\x62_version\x18\x03 \x01(\t\x12<\n\x0foverride_config\x18\x04 \x03(\x0b\x32#.flwr.proto.Run.OverrideConfigEntry\x12\x10\n\x08\x66\x61\x62_hash\x18\x05 \x01(\t\x1aI\n\x13OverrideConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.flwr.proto.Scalar:\x02\x38\x01\"@\n\tRunStatus\x12\x0e\n\x06status\x18\x01 \x01(\t\x12\x12\n\nsub_status\x18\x02 \x01(\t\x12\x0f\n\x07\x64\x65tails\x18\x03 \x01(\t\"\xeb\x01\n\x10\x43reateRunRequest\x12\x0e\n\x06\x66\x61\x62_id\x18\x01 \x01(\t\x12\x13\n\x0b\x66\x61\x62_version\x18\x02 \x01(\t\x12I\n\x0foverride_config\x18\x03 \x03(\x0b\x32\x30.flwr.proto.CreateRunRequest.OverrideConfigEntry\x12\x1c\n\x03\x66\x61\x62\x18\x04 \x01(\x0b\x32\x0f.flwr.proto.Fab\x1aI\n\x13OverrideConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.flwr.proto.Scalar:\x02\x38\x01\"#\n\x11\x43reateRunResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\"?\n\rGetRunRequest\x12\x1e\n\x04node\x18\x01 \x01(\x0b\x32\x10.flwr.proto.Node\x12\x0e\n\x06run_id\x18\x02 \x01(\x04\".\n\x0eGetRunResponse\x12\x1c\n\x03run\x18\x01 \x01(\x0b\x32\x0f.flwr.proto.Run\"S\n\x16UpdateRunStatusRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\x12)\n\nrun_status\x18\x02 \x01(\x0b\x32\x15.flwr.proto.RunStatus\"\x19\n\x17UpdateRunStatusResponse\"F\n\x13GetRunStatusRequest\x12\x1e\n\x04node\x18\x01 \x01(\x0b\x32\x10.flwr.proto.Node\x12\x0f\n\x07run_ids\x18\x02 \x03(\x04\"\xb1\x01\n\x14GetRunStatusResponse\x12L\n\x0frun_status_dict\x18\x01 \x03(\x0b\x32\x33.flwr.proto.GetRunStatusResponse.RunStatusDictEntry\x1aK\n\x12RunStatusDictEntry\x12\x0b\n\x03key\x18\x01 \x01(\x04\x12$\n\x05value\x18\x02 \x01(\x0b\x32\x15.flwr.proto.RunStatus:\x02\x38\x01\x62\x06proto3')
21
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14\x66lwr/proto/run.proto\x12\nflwr.proto\x1a\x14\x66lwr/proto/fab.proto\x1a\x15\x66lwr/proto/node.proto\x1a\x1a\x66lwr/proto/recordset.proto\x1a\x1a\x66lwr/proto/transport.proto\"\xd5\x01\n\x03Run\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\x12\x0e\n\x06\x66\x61\x62_id\x18\x02 \x01(\t\x12\x13\n\x0b\x66\x61\x62_version\x18\x03 \x01(\t\x12<\n\x0foverride_config\x18\x04 \x03(\x0b\x32#.flwr.proto.Run.OverrideConfigEntry\x12\x10\n\x08\x66\x61\x62_hash\x18\x05 \x01(\t\x1aI\n\x13OverrideConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.flwr.proto.Scalar:\x02\x38\x01\"@\n\tRunStatus\x12\x0e\n\x06status\x18\x01 \x01(\t\x12\x12\n\nsub_status\x18\x02 \x01(\t\x12\x0f\n\x07\x64\x65tails\x18\x03 \x01(\t\"\xeb\x01\n\x10\x43reateRunRequest\x12\x0e\n\x06\x66\x61\x62_id\x18\x01 \x01(\t\x12\x13\n\x0b\x66\x61\x62_version\x18\x02 \x01(\t\x12I\n\x0foverride_config\x18\x03 \x03(\x0b\x32\x30.flwr.proto.CreateRunRequest.OverrideConfigEntry\x12\x1c\n\x03\x66\x61\x62\x18\x04 \x01(\x0b\x32\x0f.flwr.proto.Fab\x1aI\n\x13OverrideConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.flwr.proto.Scalar:\x02\x38\x01\"#\n\x11\x43reateRunResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\"?\n\rGetRunRequest\x12\x1e\n\x04node\x18\x01 \x01(\x0b\x32\x10.flwr.proto.Node\x12\x0e\n\x06run_id\x18\x02 \x01(\x04\".\n\x0eGetRunResponse\x12\x1c\n\x03run\x18\x01 \x01(\x0b\x32\x0f.flwr.proto.Run\"S\n\x16UpdateRunStatusRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\x12)\n\nrun_status\x18\x02 \x01(\x0b\x32\x15.flwr.proto.RunStatus\"\x19\n\x17UpdateRunStatusResponse\"F\n\x13GetRunStatusRequest\x12\x1e\n\x04node\x18\x01 \x01(\x0b\x32\x10.flwr.proto.Node\x12\x0f\n\x07run_ids\x18\x02 \x03(\x04\"\xb1\x01\n\x14GetRunStatusResponse\x12L\n\x0frun_status_dict\x18\x01 \x03(\x0b\x32\x33.flwr.proto.GetRunStatusResponse.RunStatusDictEntry\x1aK\n\x12RunStatusDictEntry\x12\x0b\n\x03key\x18\x01 \x01(\x04\x12$\n\x05value\x18\x02 \x01(\x0b\x32\x15.flwr.proto.RunStatus:\x02\x38\x01\"-\n\x1bGetFederationOptionsRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\"U\n\x1cGetFederationOptionsResponse\x12\x35\n\x12\x66\x65\x64\x65ration_options\x18\x01 \x01(\x0b\x32\x19.flwr.proto.ConfigsRecordb\x06proto3')
21
22
 
22
23
  _globals = globals()
23
24
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -30,30 +31,34 @@ if _descriptor._USE_C_DESCRIPTORS == False:
30
31
  _globals['_CREATERUNREQUEST_OVERRIDECONFIGENTRY']._serialized_options = b'8\001'
31
32
  _globals['_GETRUNSTATUSRESPONSE_RUNSTATUSDICTENTRY']._options = None
32
33
  _globals['_GETRUNSTATUSRESPONSE_RUNSTATUSDICTENTRY']._serialized_options = b'8\001'
33
- _globals['_RUN']._serialized_start=110
34
- _globals['_RUN']._serialized_end=323
35
- _globals['_RUN_OVERRIDECONFIGENTRY']._serialized_start=250
36
- _globals['_RUN_OVERRIDECONFIGENTRY']._serialized_end=323
37
- _globals['_RUNSTATUS']._serialized_start=325
38
- _globals['_RUNSTATUS']._serialized_end=389
39
- _globals['_CREATERUNREQUEST']._serialized_start=392
40
- _globals['_CREATERUNREQUEST']._serialized_end=627
41
- _globals['_CREATERUNREQUEST_OVERRIDECONFIGENTRY']._serialized_start=250
42
- _globals['_CREATERUNREQUEST_OVERRIDECONFIGENTRY']._serialized_end=323
43
- _globals['_CREATERUNRESPONSE']._serialized_start=629
44
- _globals['_CREATERUNRESPONSE']._serialized_end=664
45
- _globals['_GETRUNREQUEST']._serialized_start=666
46
- _globals['_GETRUNREQUEST']._serialized_end=729
47
- _globals['_GETRUNRESPONSE']._serialized_start=731
48
- _globals['_GETRUNRESPONSE']._serialized_end=777
49
- _globals['_UPDATERUNSTATUSREQUEST']._serialized_start=779
50
- _globals['_UPDATERUNSTATUSREQUEST']._serialized_end=862
51
- _globals['_UPDATERUNSTATUSRESPONSE']._serialized_start=864
52
- _globals['_UPDATERUNSTATUSRESPONSE']._serialized_end=889
53
- _globals['_GETRUNSTATUSREQUEST']._serialized_start=891
54
- _globals['_GETRUNSTATUSREQUEST']._serialized_end=961
55
- _globals['_GETRUNSTATUSRESPONSE']._serialized_start=964
56
- _globals['_GETRUNSTATUSRESPONSE']._serialized_end=1141
57
- _globals['_GETRUNSTATUSRESPONSE_RUNSTATUSDICTENTRY']._serialized_start=1066
58
- _globals['_GETRUNSTATUSRESPONSE_RUNSTATUSDICTENTRY']._serialized_end=1141
34
+ _globals['_RUN']._serialized_start=138
35
+ _globals['_RUN']._serialized_end=351
36
+ _globals['_RUN_OVERRIDECONFIGENTRY']._serialized_start=278
37
+ _globals['_RUN_OVERRIDECONFIGENTRY']._serialized_end=351
38
+ _globals['_RUNSTATUS']._serialized_start=353
39
+ _globals['_RUNSTATUS']._serialized_end=417
40
+ _globals['_CREATERUNREQUEST']._serialized_start=420
41
+ _globals['_CREATERUNREQUEST']._serialized_end=655
42
+ _globals['_CREATERUNREQUEST_OVERRIDECONFIGENTRY']._serialized_start=278
43
+ _globals['_CREATERUNREQUEST_OVERRIDECONFIGENTRY']._serialized_end=351
44
+ _globals['_CREATERUNRESPONSE']._serialized_start=657
45
+ _globals['_CREATERUNRESPONSE']._serialized_end=692
46
+ _globals['_GETRUNREQUEST']._serialized_start=694
47
+ _globals['_GETRUNREQUEST']._serialized_end=757
48
+ _globals['_GETRUNRESPONSE']._serialized_start=759
49
+ _globals['_GETRUNRESPONSE']._serialized_end=805
50
+ _globals['_UPDATERUNSTATUSREQUEST']._serialized_start=807
51
+ _globals['_UPDATERUNSTATUSREQUEST']._serialized_end=890
52
+ _globals['_UPDATERUNSTATUSRESPONSE']._serialized_start=892
53
+ _globals['_UPDATERUNSTATUSRESPONSE']._serialized_end=917
54
+ _globals['_GETRUNSTATUSREQUEST']._serialized_start=919
55
+ _globals['_GETRUNSTATUSREQUEST']._serialized_end=989
56
+ _globals['_GETRUNSTATUSRESPONSE']._serialized_start=992
57
+ _globals['_GETRUNSTATUSRESPONSE']._serialized_end=1169
58
+ _globals['_GETRUNSTATUSRESPONSE_RUNSTATUSDICTENTRY']._serialized_start=1094
59
+ _globals['_GETRUNSTATUSRESPONSE_RUNSTATUSDICTENTRY']._serialized_end=1169
60
+ _globals['_GETFEDERATIONOPTIONSREQUEST']._serialized_start=1171
61
+ _globals['_GETFEDERATIONOPTIONSREQUEST']._serialized_end=1216
62
+ _globals['_GETFEDERATIONOPTIONSRESPONSE']._serialized_start=1218
63
+ _globals['_GETFEDERATIONOPTIONSRESPONSE']._serialized_end=1303
59
64
  # @@protoc_insertion_point(module_scope)
flwr/proto/run_pb2.pyi CHANGED
@@ -5,6 +5,7 @@ isort:skip_file
5
5
  import builtins
6
6
  import flwr.proto.fab_pb2
7
7
  import flwr.proto.node_pb2
8
+ import flwr.proto.recordset_pb2
8
9
  import flwr.proto.transport_pb2
9
10
  import google.protobuf.descriptor
10
11
  import google.protobuf.internal.containers
@@ -223,3 +224,28 @@ class GetRunStatusResponse(google.protobuf.message.Message):
223
224
  ) -> None: ...
224
225
  def ClearField(self, field_name: typing_extensions.Literal["run_status_dict",b"run_status_dict"]) -> None: ...
225
226
  global___GetRunStatusResponse = GetRunStatusResponse
227
+
228
+ class GetFederationOptionsRequest(google.protobuf.message.Message):
229
+ """Get Federation Options associated with run"""
230
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
231
+ RUN_ID_FIELD_NUMBER: builtins.int
232
+ run_id: builtins.int
233
+ def __init__(self,
234
+ *,
235
+ run_id: builtins.int = ...,
236
+ ) -> None: ...
237
+ def ClearField(self, field_name: typing_extensions.Literal["run_id",b"run_id"]) -> None: ...
238
+ global___GetFederationOptionsRequest = GetFederationOptionsRequest
239
+
240
+ class GetFederationOptionsResponse(google.protobuf.message.Message):
241
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
242
+ FEDERATION_OPTIONS_FIELD_NUMBER: builtins.int
243
+ @property
244
+ def federation_options(self) -> flwr.proto.recordset_pb2.ConfigsRecord: ...
245
+ def __init__(self,
246
+ *,
247
+ federation_options: typing.Optional[flwr.proto.recordset_pb2.ConfigsRecord] = ...,
248
+ ) -> None: ...
249
+ def HasField(self, field_name: typing_extensions.Literal["federation_options",b"federation_options"]) -> builtins.bool: ...
250
+ def ClearField(self, field_name: typing_extensions.Literal["federation_options",b"federation_options"]) -> None: ...
251
+ global___GetFederationOptionsResponse = GetFederationOptionsResponse
@@ -18,7 +18,7 @@ from flwr.proto import run_pb2 as flwr_dot_proto_dot_run__pb2
18
18
  from flwr.proto import fab_pb2 as flwr_dot_proto_dot_fab__pb2
19
19
 
20
20
 
21
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1d\x66lwr/proto/simulationio.proto\x12\nflwr.proto\x1a\x14\x66lwr/proto/log.proto\x1a\x18\x66lwr/proto/message.proto\x1a\x14\x66lwr/proto/run.proto\x1a\x14\x66lwr/proto/fab.proto\"\x1d\n\x1bPullSimulationInputsRequest\"\x80\x01\n\x1cPullSimulationInputsResponse\x12$\n\x07\x63ontext\x18\x01 \x01(\x0b\x32\x13.flwr.proto.Context\x12\x1c\n\x03run\x18\x02 \x01(\x0b\x32\x0f.flwr.proto.Run\x12\x1c\n\x03\x66\x61\x62\x18\x03 \x01(\x0b\x32\x0f.flwr.proto.Fab\"T\n\x1cPushSimulationOutputsRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\x12$\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x13.flwr.proto.Context\"\x1f\n\x1dPushSimulationOutputsResponse2\x92\x03\n\x0cSimulationIo\x12k\n\x14PullSimulationInputs\x12\'.flwr.proto.PullSimulationInputsRequest\x1a(.flwr.proto.PullSimulationInputsResponse\"\x00\x12n\n\x15PushSimulationOutputs\x12(.flwr.proto.PushSimulationOutputsRequest\x1a).flwr.proto.PushSimulationOutputsResponse\"\x00\x12\\\n\x0fUpdateRunStatus\x12\".flwr.proto.UpdateRunStatusRequest\x1a#.flwr.proto.UpdateRunStatusResponse\"\x00\x12G\n\x08PushLogs\x12\x1b.flwr.proto.PushLogsRequest\x1a\x1c.flwr.proto.PushLogsResponse\"\x00\x62\x06proto3')
21
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1d\x66lwr/proto/simulationio.proto\x12\nflwr.proto\x1a\x14\x66lwr/proto/log.proto\x1a\x18\x66lwr/proto/message.proto\x1a\x14\x66lwr/proto/run.proto\x1a\x14\x66lwr/proto/fab.proto\"\x1d\n\x1bPullSimulationInputsRequest\"\x80\x01\n\x1cPullSimulationInputsResponse\x12$\n\x07\x63ontext\x18\x01 \x01(\x0b\x32\x13.flwr.proto.Context\x12\x1c\n\x03run\x18\x02 \x01(\x0b\x32\x0f.flwr.proto.Run\x12\x1c\n\x03\x66\x61\x62\x18\x03 \x01(\x0b\x32\x0f.flwr.proto.Fab\"T\n\x1cPushSimulationOutputsRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\x12$\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x13.flwr.proto.Context\"\x1f\n\x1dPushSimulationOutputsResponse2\xff\x03\n\x0cSimulationIo\x12k\n\x14PullSimulationInputs\x12\'.flwr.proto.PullSimulationInputsRequest\x1a(.flwr.proto.PullSimulationInputsResponse\"\x00\x12n\n\x15PushSimulationOutputs\x12(.flwr.proto.PushSimulationOutputsRequest\x1a).flwr.proto.PushSimulationOutputsResponse\"\x00\x12\\\n\x0fUpdateRunStatus\x12\".flwr.proto.UpdateRunStatusRequest\x1a#.flwr.proto.UpdateRunStatusResponse\"\x00\x12G\n\x08PushLogs\x12\x1b.flwr.proto.PushLogsRequest\x1a\x1c.flwr.proto.PushLogsResponse\"\x00\x12k\n\x14GetFederationOptions\x12\'.flwr.proto.GetFederationOptionsRequest\x1a(.flwr.proto.GetFederationOptionsResponse\"\x00\x62\x06proto3')
22
22
 
23
23
  _globals = globals()
24
24
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -34,5 +34,5 @@ if _descriptor._USE_C_DESCRIPTORS == False:
34
34
  _globals['_PUSHSIMULATIONOUTPUTSRESPONSE']._serialized_start=385
35
35
  _globals['_PUSHSIMULATIONOUTPUTSRESPONSE']._serialized_end=416
36
36
  _globals['_SIMULATIONIO']._serialized_start=419
37
- _globals['_SIMULATIONIO']._serialized_end=821
37
+ _globals['_SIMULATIONIO']._serialized_end=930
38
38
  # @@protoc_insertion_point(module_scope)
@@ -36,6 +36,11 @@ class SimulationIoStub(object):
36
36
  request_serializer=flwr_dot_proto_dot_log__pb2.PushLogsRequest.SerializeToString,
37
37
  response_deserializer=flwr_dot_proto_dot_log__pb2.PushLogsResponse.FromString,
38
38
  )
39
+ self.GetFederationOptions = channel.unary_unary(
40
+ '/flwr.proto.SimulationIo/GetFederationOptions',
41
+ request_serializer=flwr_dot_proto_dot_run__pb2.GetFederationOptionsRequest.SerializeToString,
42
+ response_deserializer=flwr_dot_proto_dot_run__pb2.GetFederationOptionsResponse.FromString,
43
+ )
39
44
 
40
45
 
41
46
  class SimulationIoServicer(object):
@@ -69,6 +74,13 @@ class SimulationIoServicer(object):
69
74
  context.set_details('Method not implemented!')
70
75
  raise NotImplementedError('Method not implemented!')
71
76
 
77
+ def GetFederationOptions(self, request, context):
78
+ """Get Federation Options
79
+ """
80
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
81
+ context.set_details('Method not implemented!')
82
+ raise NotImplementedError('Method not implemented!')
83
+
72
84
 
73
85
  def add_SimulationIoServicer_to_server(servicer, server):
74
86
  rpc_method_handlers = {
@@ -92,6 +104,11 @@ def add_SimulationIoServicer_to_server(servicer, server):
92
104
  request_deserializer=flwr_dot_proto_dot_log__pb2.PushLogsRequest.FromString,
93
105
  response_serializer=flwr_dot_proto_dot_log__pb2.PushLogsResponse.SerializeToString,
94
106
  ),
107
+ 'GetFederationOptions': grpc.unary_unary_rpc_method_handler(
108
+ servicer.GetFederationOptions,
109
+ request_deserializer=flwr_dot_proto_dot_run__pb2.GetFederationOptionsRequest.FromString,
110
+ response_serializer=flwr_dot_proto_dot_run__pb2.GetFederationOptionsResponse.SerializeToString,
111
+ ),
95
112
  }
96
113
  generic_handler = grpc.method_handlers_generic_handler(
97
114
  'flwr.proto.SimulationIo', rpc_method_handlers)
@@ -169,3 +186,20 @@ class SimulationIo(object):
169
186
  flwr_dot_proto_dot_log__pb2.PushLogsResponse.FromString,
170
187
  options, channel_credentials,
171
188
  insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
189
+
190
+ @staticmethod
191
+ def GetFederationOptions(request,
192
+ target,
193
+ options=(),
194
+ channel_credentials=None,
195
+ call_credentials=None,
196
+ insecure=False,
197
+ compression=None,
198
+ wait_for_ready=None,
199
+ timeout=None,
200
+ metadata=None):
201
+ return grpc.experimental.unary_unary(request, target, '/flwr.proto.SimulationIo/GetFederationOptions',
202
+ flwr_dot_proto_dot_run__pb2.GetFederationOptionsRequest.SerializeToString,
203
+ flwr_dot_proto_dot_run__pb2.GetFederationOptionsResponse.FromString,
204
+ options, channel_credentials,
205
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@@ -30,6 +30,11 @@ class SimulationIoStub:
30
30
  flwr.proto.log_pb2.PushLogsResponse]
31
31
  """Push ServerApp logs"""
32
32
 
33
+ GetFederationOptions: grpc.UnaryUnaryMultiCallable[
34
+ flwr.proto.run_pb2.GetFederationOptionsRequest,
35
+ flwr.proto.run_pb2.GetFederationOptionsResponse]
36
+ """Get Federation Options"""
37
+
33
38
 
34
39
  class SimulationIoServicer(metaclass=abc.ABCMeta):
35
40
  @abc.abstractmethod
@@ -64,5 +69,13 @@ class SimulationIoServicer(metaclass=abc.ABCMeta):
64
69
  """Push ServerApp logs"""
65
70
  pass
66
71
 
72
+ @abc.abstractmethod
73
+ def GetFederationOptions(self,
74
+ request: flwr.proto.run_pb2.GetFederationOptionsRequest,
75
+ context: grpc.ServicerContext,
76
+ ) -> flwr.proto.run_pb2.GetFederationOptionsResponse:
77
+ """Get Federation Options"""
78
+ pass
79
+
67
80
 
68
81
  def add_SimulationIoServicer_to_server(servicer: SimulationIoServicer, server: grpc.Server) -> None: ...
@@ -48,12 +48,12 @@ def aggregate_inplace(results: list[tuple[ClientProxy, FitRes]]) -> NDArrays:
48
48
  num_examples_total = sum(fit_res.num_examples for (_, fit_res) in results)
49
49
 
50
50
  # Compute scaling factors for each result
51
- scaling_factors = [
52
- fit_res.num_examples / num_examples_total for _, fit_res in results
53
- ]
51
+ scaling_factors = np.asarray(
52
+ [fit_res.num_examples / num_examples_total for _, fit_res in results]
53
+ )
54
54
 
55
55
  def _try_inplace(
56
- x: NDArray, y: Union[NDArray, float], np_binary_op: np.ufunc
56
+ x: NDArray, y: Union[NDArray, np.float64], np_binary_op: np.ufunc
57
57
  ) -> NDArray:
58
58
  return ( # type: ignore[no-any-return]
59
59
  np_binary_op(x, y, out=x)
@@ -23,6 +23,7 @@ from grpc import ServicerContext
23
23
  from flwr.common.constant import Status
24
24
  from flwr.common.logger import log
25
25
  from flwr.common.serde import (
26
+ configs_record_to_proto,
26
27
  context_from_proto,
27
28
  context_to_proto,
28
29
  fab_to_proto,
@@ -36,6 +37,8 @@ from flwr.proto.log_pb2 import ( # pylint: disable=E0611
36
37
  PushLogsResponse,
37
38
  )
38
39
  from flwr.proto.run_pb2 import ( # pylint: disable=E0611
40
+ GetFederationOptionsRequest,
41
+ GetFederationOptionsResponse,
39
42
  UpdateRunStatusRequest,
40
43
  UpdateRunStatusResponse,
41
44
  )
@@ -123,10 +126,28 @@ class SimulationIoServicer(simulationio_pb2_grpc.SimulationIoServicer):
123
126
  self, request: PushLogsRequest, context: grpc.ServicerContext
124
127
  ) -> PushLogsResponse:
125
128
  """Push logs."""
126
- log(DEBUG, "ServerAppIoServicer.PushLogs")
129
+ log(DEBUG, "SimultionIoServicer.PushLogs")
127
130
  state = self.state_factory.state()
128
131
 
129
132
  # Add logs to LinkState
130
133
  merged_logs = "".join(request.logs)
131
134
  state.add_serverapp_log(request.run_id, merged_logs)
132
135
  return PushLogsResponse()
136
+
137
+ def GetFederationOptions(
138
+ self, request: GetFederationOptionsRequest, context: ServicerContext
139
+ ) -> GetFederationOptionsResponse:
140
+ """Get Federation Options associated with a run."""
141
+ log(DEBUG, "SimultionIoServicer.GetFederationOptions")
142
+ state = self.state_factory.state()
143
+
144
+ federation_options = state.get_federation_options(request.run_id)
145
+ if federation_options is None:
146
+ context.abort(
147
+ grpc.StatusCode.FAILED_PRECONDITION,
148
+ "Expected federation options to be set, but none available.",
149
+ )
150
+ return GetFederationOptionsResponse()
151
+ return GetFederationOptionsResponse(
152
+ federation_options=configs_record_to_proto(federation_options)
153
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flwr-nightly
3
- Version: 1.13.0.dev20241107
3
+ Version: 1.13.0.dev20241109
4
4
  Summary: Flower: A Friendly Federated Learning Framework
5
5
  Home-page: https://flower.ai
6
6
  License: Apache-2.0
@@ -32,9 +32,9 @@ Classifier: Typing :: Typed
32
32
  Provides-Extra: rest
33
33
  Provides-Extra: simulation
34
34
  Requires-Dist: cryptography (>=42.0.4,<43.0.0)
35
- Requires-Dist: grpcio (>=1.60.0,<2.0.0,!=1.64.2,!=1.65.1,!=1.65.2,!=1.65.4,!=1.65.5,!=1.66.0,!=1.66.1)
35
+ Requires-Dist: grpcio (>=1.60.0,<2.0.0,!=1.64.2,<=1.64.3)
36
36
  Requires-Dist: iterators (>=0.0.2,<0.0.3)
37
- Requires-Dist: numpy (>=1.21.0,<2.0.0)
37
+ Requires-Dist: numpy (>=1.26.0,<3.0.0)
38
38
  Requires-Dist: pathspec (>=0.12.1,<0.13.0)
39
39
  Requires-Dist: protobuf (>=4.25.2,<5.0.0)
40
40
  Requires-Dist: pycryptodome (>=3.18.0,<4.0.0)
@@ -116,7 +116,7 @@ flwr/common/exit_handlers.py,sha256=MracJaBeoCOC7TaXK9zCJQxhrMSx9ZtczK237qvhBpU,
116
116
  flwr/common/grpc.py,sha256=6Yi28JjAll19nxYJlOT9B03RN8dvJZP9zUoR3RSmxoY,2487
117
117
  flwr/common/logger.py,sha256=AJNu-cymiQUp4Dw1zkw5xww_HVkUAhHvtYxwzUtuohM,11065
118
118
  flwr/common/message.py,sha256=4O1m0OWXBAYZz05gKgEtnoJ94J1gjo7hCNHyUXThxRo,13831
119
- flwr/common/object_ref.py,sha256=DiTvqzx_WNmNmiPXFexvADTeODhRD0Vg2dpqsH4aS44,9064
119
+ flwr/common/object_ref.py,sha256=DavEkh-IJv_s0VeLsJvSZS5k-Ix_k1UcNXbldfNFXxM,9859
120
120
  flwr/common/parameter.py,sha256=-bFAUayToYDF50FZGrBC1hQYJCQDtB2bbr3ZuVLMtdE,2095
121
121
  flwr/common/pyproject.py,sha256=EI_ovbCHGmhYrdPx0RSDi5EkFZFof-8m1PA54c0ZTjc,1385
122
122
  flwr/common/record/__init__.py,sha256=ejDBQOIA0OkwZAC5cK_tTPHA4oAM0Ju7Oi13-NneMlE,1054
@@ -138,7 +138,7 @@ flwr/common/secure_aggregation/secaggplus_constants.py,sha256=9MF-oQh62uD7rt9VeN
138
138
  flwr/common/secure_aggregation/secaggplus_utils.py,sha256=o7IhHH6J9xqinhQy3TdPgQpoj1XyEpyv3OQFyx81RVQ,3193
139
139
  flwr/common/serde.py,sha256=_z7-2XC-ecfEPzv2wEjJMTp9YH5FJqgQrTBZneDmhzA,30630
140
140
  flwr/common/telemetry.py,sha256=20AYNaePOBaSEh99PIuBrxRxtY53-kZ5-2Ej0JWUJmc,8731
141
- flwr/common/typing.py,sha256=fS_KmVdg0c1B87yMnccIPfjBzQ3CTRwYJcaWfmvZzEA,5103
141
+ flwr/common/typing.py,sha256=gk9B685P9_TctGOU0wxTlCRTxHbeaESn5TZiR9v6S0E,5104
142
142
  flwr/common/version.py,sha256=tCcl_FvxVK206C1dxIJCs4TjL06WmyaODBP19FRHE1c,1324
143
143
  flwr/proto/__init__.py,sha256=hbY7JYakwZwCkYgCNlmHdc8rtvfoJbAZLalMdc--CGc,683
144
144
  flwr/proto/clientappio_pb2.py,sha256=Y3PMv-JMaBGehpslgbvGY6l2u5vNpfCTFWu-fmAmBJ4,3703
@@ -189,18 +189,18 @@ flwr/proto/recordset_pb2.py,sha256=XjEIDU-YlKSY59qNd0qXTFB4COvMHGiszQ5O1krJ1Ks,6
189
189
  flwr/proto/recordset_pb2.pyi,sha256=ypFNvroU4aIlnN0D6W4XAsOfm0UzTfXhxxL1v7u__Ac,15370
190
190
  flwr/proto/recordset_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
191
191
  flwr/proto/recordset_pb2_grpc.pyi,sha256=ff2TSiLVnG6IVQcTGzb2DIH3XRSoAvAo_RMcvbMFyc0,76
192
- flwr/proto/run_pb2.py,sha256=pwel-8Hzsz1Gw2EHGEFKObgSEKQNth7nGZOEsJQO8fM,4940
193
- flwr/proto/run_pb2.pyi,sha256=pr7MPml_7gOmBuu7BO-yaU-LexamsJYxnRG-utigVAo,9641
192
+ flwr/proto/run_pb2.py,sha256=RDTp7PlvPT-1p0uUYpaQUk4bw1mYr7lktuKA7uRPfrg,5516
193
+ flwr/proto/run_pb2.pyi,sha256=M9Zdokby10jr_sBlNIFBYad97Dre0sz5AB7JI4b9OgY,10903
194
194
  flwr/proto/run_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
195
195
  flwr/proto/run_pb2_grpc.pyi,sha256=ff2TSiLVnG6IVQcTGzb2DIH3XRSoAvAo_RMcvbMFyc0,76
196
196
  flwr/proto/serverappio_pb2.py,sha256=zWnODeaj26oSx98-BFvwtWM_fYvsw9OeSIuV7JnKVvw,4822
197
197
  flwr/proto/serverappio_pb2.pyi,sha256=Ib9c32FCtjA9zZY54Ohi6B-DtLgSjokAqOExm_2uOvY,6429
198
198
  flwr/proto/serverappio_pb2_grpc.py,sha256=M__pFMmb9yTAGMHVd3_K1V6DeLRuFc9UErJHWjBAsZs,17439
199
199
  flwr/proto/serverappio_pb2_grpc.pyi,sha256=ERM-0cQVmUqrVXlvEbS2wfUZpZmv5SlIeNsGZPYMrVo,4779
200
- flwr/proto/simulationio_pb2.py,sha256=Za9bndkWX7TPoiNmlnQeRHR4DQ2UrbaagDtirKOb-0U,2884
200
+ flwr/proto/simulationio_pb2.py,sha256=sCJQp_NEJSDtC4EKzyy2yZWtu9z7PGUUFJpLjdA9VUs,3011
201
201
  flwr/proto/simulationio_pb2.pyi,sha256=oXx8_FLBe5B54wduZj-f89kub73XxNtQbThuW8YfPAs,2660
202
- flwr/proto/simulationio_pb2_grpc.py,sha256=6bLKBXsB8Oam8RurI0i8kPKe_1VpnbqY7RrD9nqs1PM,7900
203
- flwr/proto/simulationio_pb2_grpc.pyi,sha256=d_BJaLr6bG_lcQoZuyglqAr6uJm6ttJhE0sk4zZf5N8,2320
202
+ flwr/proto/simulationio_pb2_grpc.py,sha256=-qcd4rOOK-46LcP57oZswqwASpy2_UvMJmJ80OpzuNM,9622
203
+ flwr/proto/simulationio_pb2_grpc.pyi,sha256=Bk4K7MsPpxF6RmIqByySQIXJeJ1pBrU2I19hrKUoFdI,2795
204
204
  flwr/proto/task_pb2.py,sha256=R5GfHgL8IJRI_qHWNeILl1Y9zHjvB0tnCvMHmTgF4Is,2361
205
205
  flwr/proto/task_pb2.pyi,sha256=KJVsLm-THY5QjHreHDm_-OS1tyZyD61mx6BzOpoeMjw,4320
206
206
  flwr/proto/task_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
@@ -233,7 +233,7 @@ flwr/server/serverapp/__init__.py,sha256=L0K-94UDdTyEZ8LDtYybGIIIv3HW6AhSVjXMUfY
233
233
  flwr/server/serverapp/app.py,sha256=yRHrTLpwRBOtcQd_VttHy8RR12LhlqFjV70H4FxQRMY,8987
234
234
  flwr/server/serverapp_components.py,sha256=-IV_CitOfrJclJj2jNdbN1Q65PyFmtKtrTIg1hc6WQw,2118
235
235
  flwr/server/strategy/__init__.py,sha256=tQer2SwjDnvgFFuJMZM-S01Z615N5XK6MaCvpm4BMU0,2836
236
- flwr/server/strategy/aggregate.py,sha256=iFZ8lp7PV_a2m9kywV-FK0iM33ofxavOs5TIaEQY8nU,13961
236
+ flwr/server/strategy/aggregate.py,sha256=PDvekufza13s9AsVmz9WASunaBs3yCtl8JVliFx9j6Q,13978
237
237
  flwr/server/strategy/bulyan.py,sha256=DDNLLlTJCHgBtij7EpDsa852GHEYjjDB1iORACZO2KE,6513
238
238
  flwr/server/strategy/dp_adaptive_clipping.py,sha256=zrqA9OfQu4gwUkLCXbh59sPsDd_x2IhNs-BER_ITzNE,17447
239
239
  flwr/server/strategy/dp_fixed_clipping.py,sha256=ILmO_AsoMpstOAYK9L6hJpqf7zE6erdMj_SD_-hHAFk,12834
@@ -292,7 +292,7 @@ flwr/server/superlink/linkstate/sqlite_linkstate.py,sha256=OndEO8VjUHXw09fDw2t65
292
292
  flwr/server/superlink/linkstate/utils.py,sha256=emryyCNnsSodqhxuxJ3vBLglwHZ_eIA_rawdL7dDVCA,6204
293
293
  flwr/server/superlink/simulation/__init__.py,sha256=mg-oapC9dkzEfjXPQFior5lpWj4g9kwbLovptyYM_g0,718
294
294
  flwr/server/superlink/simulation/simulationio_grpc.py,sha256=5wflYW_TS0mjmPG6OYuHMJwXD2_cYmUNhFkdOU0jMWQ,2237
295
- flwr/server/superlink/simulation/simulationio_servicer.py,sha256=KRdgPt9vYGQorRgXwmCs65hpk7LHwMRU5RSk40m8t9I,5067
295
+ flwr/server/superlink/simulation/simulationio_servicer.py,sha256=LsW6Cl8qH_vq04F6CeOp3vBtjTGQn4tATKHfirDmJZQ,5942
296
296
  flwr/server/typing.py,sha256=5kaRLZuxTEse9A0g7aVna2VhYxU3wTq1f3d3mtw7kXs,1019
297
297
  flwr/server/utils/__init__.py,sha256=pltsPHJoXmUIr3utjwwYxu7_ZAGy5u4MVHzv9iA5Un8,908
298
298
  flwr/server/utils/tensorboard.py,sha256=gEBD8w_5uaIfp5aw5RYH66lYZpd_SfkObHQ7eDd9MUk,5466
@@ -318,8 +318,8 @@ flwr/superexec/exec_grpc.py,sha256=OuhBAk7hiky9rjGceinLGIXqchtzGPQThZnwyYv6Ei0,2
318
318
  flwr/superexec/exec_servicer.py,sha256=zNcdPkqLXgJIANKvE9uGIzgxocIs31WAj1YDnwqI6jo,3958
319
319
  flwr/superexec/executor.py,sha256=zH3_53il6Jh0ZscIVEB9f4GNnXMeBbCGyCoBCxLgiG0,3114
320
320
  flwr/superexec/simulation.py,sha256=prqEgAKnejHcYEj_euK1ICaHHt3QgLa3jnZJkDA7qqI,7623
321
- flwr_nightly-1.13.0.dev20241107.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
322
- flwr_nightly-1.13.0.dev20241107.dist-info/METADATA,sha256=7aLEvmo7nOuBJYOVCCHQcLyzcjVEzMzZbHb6Vrd0hDQ,15618
323
- flwr_nightly-1.13.0.dev20241107.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
324
- flwr_nightly-1.13.0.dev20241107.dist-info/entry_points.txt,sha256=FxJQ96pmcNF2OvkTH6XF-Ip2PNrHvykjArkvkjQC7Mk,486
325
- flwr_nightly-1.13.0.dev20241107.dist-info/RECORD,,
321
+ flwr_nightly-1.13.0.dev20241109.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
322
+ flwr_nightly-1.13.0.dev20241109.dist-info/METADATA,sha256=BYkNsKx7Yndch0MzjoD6bIPpakvDl9XtFov1Oa7uG_4,15573
323
+ flwr_nightly-1.13.0.dev20241109.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
324
+ flwr_nightly-1.13.0.dev20241109.dist-info/entry_points.txt,sha256=FxJQ96pmcNF2OvkTH6XF-Ip2PNrHvykjArkvkjQC7Mk,486
325
+ flwr_nightly-1.13.0.dev20241109.dist-info/RECORD,,