flwr-nightly 1.10.0.dev20240618__py3-none-any.whl → 1.10.0.dev20240620__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.

Files changed (98) hide show
  1. flwr/cli/app.py +3 -0
  2. flwr/cli/build.py +3 -7
  3. flwr/cli/new/new.py +1 -1
  4. flwr/cli/run/run.py +8 -1
  5. flwr/client/__init__.py +1 -1
  6. flwr/client/app.py +4 -0
  7. flwr/client/client_app.py +1 -1
  8. flwr/client/dpfedavg_numpy_client.py +1 -1
  9. flwr/client/grpc_rere_client/__init__.py +1 -1
  10. flwr/client/grpc_rere_client/connection.py +1 -1
  11. flwr/client/message_handler/__init__.py +1 -1
  12. flwr/client/message_handler/message_handler.py +1 -1
  13. flwr/client/mod/__init__.py +4 -4
  14. flwr/client/mod/secure_aggregation/__init__.py +1 -1
  15. flwr/client/mod/utils.py +1 -1
  16. flwr/client/rest_client/__init__.py +1 -1
  17. flwr/client/rest_client/connection.py +1 -1
  18. flwr/client/supernode/app.py +29 -6
  19. flwr/common/__init__.py +12 -12
  20. flwr/common/address.py +1 -1
  21. flwr/common/config.py +8 -6
  22. flwr/common/constant.py +5 -1
  23. flwr/common/date.py +1 -1
  24. flwr/common/dp.py +1 -1
  25. flwr/common/grpc.py +1 -1
  26. flwr/common/object_ref.py +39 -5
  27. flwr/common/record/__init__.py +1 -1
  28. flwr/common/secure_aggregation/__init__.py +1 -1
  29. flwr/common/secure_aggregation/crypto/__init__.py +1 -1
  30. flwr/common/secure_aggregation/crypto/shamir.py +1 -1
  31. flwr/common/secure_aggregation/crypto/symmetric_encryption.py +1 -1
  32. flwr/common/secure_aggregation/ndarrays_arithmetic.py +1 -1
  33. flwr/common/secure_aggregation/quantization.py +1 -1
  34. flwr/common/secure_aggregation/secaggplus_constants.py +1 -1
  35. flwr/common/secure_aggregation/secaggplus_utils.py +1 -1
  36. flwr/common/version.py +14 -0
  37. flwr/server/__init__.py +2 -2
  38. flwr/server/app.py +47 -7
  39. flwr/server/compat/app.py +1 -1
  40. flwr/server/compat/app_utils.py +1 -1
  41. flwr/server/compat/driver_client_proxy.py +1 -1
  42. flwr/server/driver/driver.py +6 -0
  43. flwr/server/driver/grpc_driver.py +85 -63
  44. flwr/server/driver/inmemory_driver.py +28 -26
  45. flwr/server/run_serverapp.py +15 -8
  46. flwr/server/strategy/__init__.py +2 -2
  47. flwr/server/strategy/bulyan.py +1 -1
  48. flwr/server/strategy/dpfedavg_adaptive.py +1 -1
  49. flwr/server/strategy/dpfedavg_fixed.py +1 -1
  50. flwr/server/strategy/fedadagrad.py +1 -1
  51. flwr/server/strategy/fedadam.py +1 -1
  52. flwr/server/strategy/fedavg_android.py +1 -1
  53. flwr/server/strategy/fedavgm.py +1 -1
  54. flwr/server/strategy/fedmedian.py +1 -1
  55. flwr/server/strategy/fedopt.py +1 -1
  56. flwr/server/strategy/fedprox.py +1 -1
  57. flwr/server/strategy/fedxgb_bagging.py +1 -1
  58. flwr/server/strategy/fedxgb_cyclic.py +1 -1
  59. flwr/server/strategy/fedxgb_nn_avg.py +1 -1
  60. flwr/server/strategy/fedyogi.py +1 -1
  61. flwr/server/strategy/krum.py +1 -1
  62. flwr/server/strategy/qfedavg.py +1 -1
  63. flwr/server/superlink/driver/__init__.py +1 -1
  64. flwr/server/superlink/driver/driver_grpc.py +1 -1
  65. flwr/server/superlink/driver/driver_servicer.py +15 -3
  66. flwr/server/superlink/fleet/__init__.py +1 -1
  67. flwr/server/superlink/fleet/grpc_adapter/__init__.py +15 -0
  68. flwr/server/superlink/fleet/grpc_adapter/grpc_adapter_servicer.py +131 -0
  69. flwr/server/superlink/fleet/grpc_bidi/__init__.py +1 -1
  70. flwr/server/superlink/fleet/grpc_bidi/flower_service_servicer.py +1 -1
  71. flwr/server/superlink/fleet/grpc_bidi/grpc_bridge.py +1 -1
  72. flwr/server/superlink/fleet/grpc_bidi/grpc_client_proxy.py +1 -1
  73. flwr/server/superlink/fleet/grpc_bidi/grpc_server.py +5 -1
  74. flwr/server/superlink/fleet/grpc_rere/__init__.py +1 -1
  75. flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py +1 -1
  76. flwr/server/superlink/fleet/message_handler/__init__.py +1 -1
  77. flwr/server/superlink/fleet/message_handler/message_handler.py +1 -1
  78. flwr/server/superlink/fleet/rest_rere/__init__.py +1 -1
  79. flwr/server/superlink/fleet/rest_rere/rest_api.py +1 -1
  80. flwr/server/superlink/fleet/vce/vce_api.py +1 -1
  81. flwr/server/superlink/state/__init__.py +1 -1
  82. flwr/server/superlink/state/in_memory_state.py +1 -1
  83. flwr/server/superlink/state/sqlite_state.py +1 -1
  84. flwr/server/superlink/state/state.py +1 -1
  85. flwr/server/superlink/state/state_factory.py +11 -2
  86. flwr/server/utils/__init__.py +1 -1
  87. flwr/server/utils/tensorboard.py +1 -1
  88. flwr/simulation/__init__.py +5 -2
  89. flwr/simulation/app.py +1 -1
  90. flwr/simulation/ray_transport/__init__.py +1 -1
  91. flwr/simulation/ray_transport/ray_client_proxy.py +1 -1
  92. flwr/simulation/run_simulation.py +15 -8
  93. flwr/superexec/app.py +1 -1
  94. {flwr_nightly-1.10.0.dev20240618.dist-info → flwr_nightly-1.10.0.dev20240620.dist-info}/METADATA +2 -1
  95. {flwr_nightly-1.10.0.dev20240618.dist-info → flwr_nightly-1.10.0.dev20240620.dist-info}/RECORD +98 -96
  96. {flwr_nightly-1.10.0.dev20240618.dist-info → flwr_nightly-1.10.0.dev20240620.dist-info}/LICENSE +0 -0
  97. {flwr_nightly-1.10.0.dev20240618.dist-info → flwr_nightly-1.10.0.dev20240620.dist-info}/WHEEL +0 -0
  98. {flwr_nightly-1.10.0.dev20240618.dist-info → flwr_nightly-1.10.0.dev20240620.dist-info}/entry_points.txt +0 -0
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2021 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2023 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2023 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2023 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2023 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2021 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2022 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2021 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2022 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -35,7 +35,11 @@ from flwr.proto.driver_pb2 import ( # pylint: disable=E0611
35
35
  PushTaskInsResponse,
36
36
  )
37
37
  from flwr.proto.node_pb2 import Node # pylint: disable=E0611
38
- from flwr.proto.run_pb2 import GetRunRequest, GetRunResponse # pylint: disable=E0611
38
+ from flwr.proto.run_pb2 import ( # pylint: disable=E0611
39
+ GetRunRequest,
40
+ GetRunResponse,
41
+ Run,
42
+ )
39
43
  from flwr.proto.task_pb2 import TaskRes # pylint: disable=E0611
40
44
  from flwr.server.superlink.state import State, StateFactory
41
45
  from flwr.server.utils.validator import validate_task_ins_or_res
@@ -134,7 +138,15 @@ class DriverServicer(driver_pb2_grpc.DriverServicer):
134
138
  self, request: GetRunRequest, context: grpc.ServicerContext
135
139
  ) -> GetRunResponse:
136
140
  """Get run information."""
137
- raise NotImplementedError
141
+ log(DEBUG, "DriverServicer.GetRun")
142
+
143
+ # Init state
144
+ state: State = self.state_factory.state()
145
+
146
+ # Retrieve run information
147
+ run = state.get_run(request.run_id)
148
+ run_proto = None if run is None else Run(**vars(run))
149
+ return GetRunResponse(run=run_proto)
138
150
 
139
151
 
140
152
  def _raise_if(validation_error: bool, detail: str) -> None:
@@ -1,4 +1,4 @@
1
- # Copyright 2022 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -0,0 +1,15 @@
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ # ==============================================================================
15
+ """Server-side part of the GrpcAdapter transport layer."""
@@ -0,0 +1,131 @@
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ # ==============================================================================
15
+ """Fleet API gRPC adapter servicer."""
16
+
17
+
18
+ from logging import DEBUG, INFO
19
+ from typing import Callable, Type, TypeVar
20
+
21
+ import grpc
22
+ from google.protobuf.message import Message as GrpcMessage
23
+
24
+ from flwr.common.logger import log
25
+ from flwr.proto import grpcadapter_pb2_grpc # pylint: disable=E0611
26
+ from flwr.proto.fleet_pb2 import ( # pylint: disable=E0611
27
+ CreateNodeRequest,
28
+ CreateNodeResponse,
29
+ DeleteNodeRequest,
30
+ DeleteNodeResponse,
31
+ PingRequest,
32
+ PingResponse,
33
+ PullTaskInsRequest,
34
+ PullTaskInsResponse,
35
+ PushTaskResRequest,
36
+ PushTaskResResponse,
37
+ )
38
+ from flwr.proto.grpcadapter_pb2 import MessageContainer # pylint: disable=E0611
39
+ from flwr.proto.run_pb2 import GetRunRequest, GetRunResponse # pylint: disable=E0611
40
+ from flwr.server.superlink.fleet.message_handler import message_handler
41
+ from flwr.server.superlink.state import StateFactory
42
+
43
+ T = TypeVar("T", bound=GrpcMessage)
44
+
45
+
46
+ def _handle(
47
+ msg_container: MessageContainer,
48
+ request_type: Type[T],
49
+ handler: Callable[[T], GrpcMessage],
50
+ ) -> MessageContainer:
51
+ req = request_type.FromString(msg_container.grpc_message_content)
52
+ res = handler(req)
53
+ return MessageContainer(
54
+ metadata={},
55
+ grpc_message_name=res.__class__.__qualname__,
56
+ grpc_message_content=res.SerializeToString(),
57
+ )
58
+
59
+
60
+ class GrpcAdapterServicer(grpcadapter_pb2_grpc.GrpcAdapterServicer):
61
+ """Fleet API via GrpcAdapter servicer."""
62
+
63
+ def __init__(self, state_factory: StateFactory) -> None:
64
+ self.state_factory = state_factory
65
+
66
+ def SendReceive(
67
+ self, request: MessageContainer, context: grpc.ServicerContext
68
+ ) -> MessageContainer:
69
+ """."""
70
+ log(DEBUG, "GrpcAdapterServicer.SendReceive")
71
+ if request.grpc_message_name == CreateNodeRequest.__qualname__:
72
+ return _handle(request, CreateNodeRequest, self._create_node)
73
+ if request.grpc_message_name == DeleteNodeRequest.__qualname__:
74
+ return _handle(request, DeleteNodeRequest, self._delete_node)
75
+ if request.grpc_message_name == PingRequest.__qualname__:
76
+ return _handle(request, PingRequest, self._ping)
77
+ if request.grpc_message_name == PullTaskInsRequest.__qualname__:
78
+ return _handle(request, PullTaskInsRequest, self._pull_task_ins)
79
+ if request.grpc_message_name == PushTaskResRequest.__qualname__:
80
+ return _handle(request, PushTaskResRequest, self._push_task_res)
81
+ if request.grpc_message_name == GetRunRequest.__qualname__:
82
+ return _handle(request, GetRunRequest, self._get_run)
83
+ raise ValueError(f"Invalid grpc_message_name: {request.grpc_message_name}")
84
+
85
+ def _create_node(self, request: CreateNodeRequest) -> CreateNodeResponse:
86
+ """."""
87
+ log(INFO, "GrpcAdapter.CreateNode")
88
+ return message_handler.create_node(
89
+ request=request,
90
+ state=self.state_factory.state(),
91
+ )
92
+
93
+ def _delete_node(self, request: DeleteNodeRequest) -> DeleteNodeResponse:
94
+ """."""
95
+ log(INFO, "GrpcAdapter.DeleteNode")
96
+ return message_handler.delete_node(
97
+ request=request,
98
+ state=self.state_factory.state(),
99
+ )
100
+
101
+ def _ping(self, request: PingRequest) -> PingResponse:
102
+ """."""
103
+ log(DEBUG, "GrpcAdapter.Ping")
104
+ return message_handler.ping(
105
+ request=request,
106
+ state=self.state_factory.state(),
107
+ )
108
+
109
+ def _pull_task_ins(self, request: PullTaskInsRequest) -> PullTaskInsResponse:
110
+ """Pull TaskIns."""
111
+ log(INFO, "GrpcAdapter.PullTaskIns")
112
+ return message_handler.pull_task_ins(
113
+ request=request,
114
+ state=self.state_factory.state(),
115
+ )
116
+
117
+ def _push_task_res(self, request: PushTaskResRequest) -> PushTaskResResponse:
118
+ """Push TaskRes."""
119
+ log(INFO, "GrpcAdapter.PushTaskRes")
120
+ return message_handler.push_task_res(
121
+ request=request,
122
+ state=self.state_factory.state(),
123
+ )
124
+
125
+ def _get_run(self, request: GetRunRequest) -> GetRunResponse:
126
+ """Get run information."""
127
+ log(INFO, "GrpcAdapter.GetRun")
128
+ return message_handler.get_run(
129
+ request=request,
130
+ state=self.state_factory.state(),
131
+ )
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -29,6 +29,9 @@ from flwr.proto.transport_pb2_grpc import ( # pylint: disable=E0611
29
29
  )
30
30
  from flwr.server.client_manager import ClientManager
31
31
  from flwr.server.superlink.driver.driver_servicer import DriverServicer
32
+ from flwr.server.superlink.fleet.grpc_adapter.grpc_adapter_servicer import (
33
+ GrpcAdapterServicer,
34
+ )
32
35
  from flwr.server.superlink.fleet.grpc_bidi.flower_service_servicer import (
33
36
  FlowerServiceServicer,
34
37
  )
@@ -154,6 +157,7 @@ def start_grpc_server( # pylint: disable=too-many-arguments
154
157
  def generic_create_grpc_server( # pylint: disable=too-many-arguments
155
158
  servicer_and_add_fn: Union[
156
159
  Tuple[FleetServicer, AddServicerToServerFn],
160
+ Tuple[GrpcAdapterServicer, AddServicerToServerFn],
157
161
  Tuple[FlowerServiceServicer, AddServicerToServerFn],
158
162
  Tuple[DriverServicer, AddServicerToServerFn],
159
163
  ],
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -325,7 +325,7 @@ def start_vce(
325
325
  if app_dir is not None:
326
326
  sys.path.insert(0, app_dir)
327
327
 
328
- app: ClientApp = load_app(client_app_attr, LoadClientAppError)
328
+ app: ClientApp = load_app(client_app_attr, LoadClientAppError, app_dir)
329
329
 
330
330
  if not isinstance(app, ClientApp):
331
331
  raise LoadClientAppError(
@@ -1,4 +1,4 @@
1
- # Copyright 2023 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2023 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2023 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2022 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2022 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -26,7 +26,16 @@ from .state import State
26
26
 
27
27
 
28
28
  class StateFactory:
29
- """Factory class that creates State instances."""
29
+ """Factory class that creates State instances.
30
+
31
+ Parameters
32
+ ----------
33
+ database : str
34
+ A string representing the path to the database file that will be opened.
35
+ Note that passing ':memory:' will open a connection to a database that is
36
+ in RAM, instead of on disk. For more information on special in-memory
37
+ databases, please refer to https://sqlite.org/inmemorydb.html.
38
+ """
30
39
 
31
40
  def __init__(self, database: str) -> None:
32
41
  self.database = database
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2021 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2021 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2021 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -36,4 +36,7 @@ To install the necessary dependencies, install `flwr` with the `simulation` extr
36
36
  raise ImportError(RAY_IMPORT_ERROR)
37
37
 
38
38
 
39
- __all__ = ["start_simulation", "run_simulation"]
39
+ __all__ = [
40
+ "run_simulation",
41
+ "start_simulation",
42
+ ]
flwr/simulation/app.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2021 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2021 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Flower Labs GmbH. All Rights Reserved.
1
+ # Copyright 2021 Flower Labs GmbH. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ from typing import Dict, Optional
27
27
  from flwr.client import ClientApp
28
28
  from flwr.common import EventType, event, log
29
29
  from flwr.common.logger import set_logger_propagation, update_console_handler
30
- from flwr.common.typing import ConfigsRecordValues
30
+ from flwr.common.typing import ConfigsRecordValues, Run
31
31
  from flwr.server.driver import Driver, InMemoryDriver
32
32
  from flwr.server.run_serverapp import run
33
33
  from flwr.server.server_app import ServerApp
@@ -169,11 +169,14 @@ def run_serverapp_th(
169
169
  return serverapp_th
170
170
 
171
171
 
172
- def _init_run_id(driver: InMemoryDriver, state: StateFactory, run_id: int) -> None:
173
- """Create a run with a given `run_id`."""
172
+ def _override_run_id(state: StateFactory, run_id_to_replace: int, run_id: int) -> None:
173
+ """Override the run_id of an existing Run."""
174
174
  log(DEBUG, "Pre-registering run with id %s", run_id)
175
- state.state().run_ids[run_id] = ("", "") # type: ignore
176
- driver.run_id = run_id
175
+ # Remove run
176
+ run_info: Run = state.state().run_ids.pop(run_id_to_replace) # type: ignore
177
+ # Update with new run_id and insert back in state
178
+ run_info.run_id = run_id
179
+ state.state().run_ids[run_id] = run_info # type: ignore
177
180
 
178
181
 
179
182
  # pylint: disable=too-many-locals
@@ -201,11 +204,15 @@ def _main_loop(
201
204
  f_stop = asyncio.Event()
202
205
  serverapp_th = None
203
206
  try:
204
- # Initialize Driver
205
- driver = InMemoryDriver(state_factory)
207
+ # Create run (with empty fab_id and fab_version)
208
+ run_id_ = state_factory.state().create_run("", "")
206
209
 
207
210
  if run_id:
208
- _init_run_id(driver, state_factory, run_id)
211
+ _override_run_id(state_factory, run_id_to_replace=run_id_, run_id=run_id)
212
+ run_id_ = run_id
213
+
214
+ # Initialize Driver
215
+ driver = InMemoryDriver(run_id=run_id_, state_factory=state_factory)
209
216
 
210
217
  # Get and run ServerApp thread
211
218
  serverapp_th = run_serverapp_th(
flwr/superexec/app.py CHANGED
@@ -164,7 +164,7 @@ def _load_executor(
164
164
  if not valid and error_msg:
165
165
  raise LoadExecutorError(error_msg) from None
166
166
 
167
- executor = load_app(executor_ref, LoadExecutorError)
167
+ executor = load_app(executor_ref, LoadExecutorError, args.executor_dir)
168
168
 
169
169
  if not isinstance(executor, Executor):
170
170
  raise LoadExecutorError(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flwr-nightly
3
- Version: 1.10.0.dev20240618
3
+ Version: 1.10.0.dev20240620
4
4
  Summary: Flower: A Friendly Federated Learning Framework
5
5
  Home-page: https://flower.ai
6
6
  License: Apache-2.0
@@ -204,6 +204,7 @@ Other [examples](https://github.com/adap/flower/tree/main/examples):
204
204
  - [Flower with KaplanMeierFitter from the lifelines library](https://github.com/adap/flower/tree/main/examples/federated-kaplan-meier-fitter)
205
205
  - [Sample Level Privacy with Opacus](https://github.com/adap/flower/tree/main/examples/opacus)
206
206
  - [Sample Level Privacy with TensorFlow-Privacy](https://github.com/adap/flower/tree/main/examples/tensorflow-privacy)
207
+ - [Flower with a Tabular Dataset] (https://github.com/adap/flower/tree/main/examples/fl-tabular)
207
208
 
208
209
  ## Community
209
210