flwr-nightly 1.8.0.dev20240315__py3-none-any.whl → 1.15.0.dev20250115__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (312) hide show
  1. flwr/cli/app.py +16 -2
  2. flwr/cli/build.py +181 -0
  3. flwr/cli/cli_user_auth_interceptor.py +90 -0
  4. flwr/cli/config_utils.py +343 -0
  5. flwr/cli/example.py +4 -1
  6. flwr/cli/install.py +253 -0
  7. flwr/cli/log.py +182 -0
  8. flwr/{server/superlink/state → cli/login}/__init__.py +4 -10
  9. flwr/cli/login/login.py +88 -0
  10. flwr/cli/ls.py +327 -0
  11. flwr/cli/new/__init__.py +1 -0
  12. flwr/cli/new/new.py +210 -66
  13. flwr/cli/new/templates/app/.gitignore.tpl +163 -0
  14. flwr/cli/new/templates/app/LICENSE.tpl +202 -0
  15. flwr/cli/new/templates/app/README.baseline.md.tpl +127 -0
  16. flwr/cli/new/templates/app/README.flowertune.md.tpl +66 -0
  17. flwr/cli/new/templates/app/README.md.tpl +16 -32
  18. flwr/cli/new/templates/app/code/__init__.baseline.py.tpl +1 -0
  19. flwr/cli/new/templates/app/code/__init__.py.tpl +1 -1
  20. flwr/cli/new/templates/app/code/client.baseline.py.tpl +58 -0
  21. flwr/cli/new/templates/app/code/client.huggingface.py.tpl +55 -0
  22. flwr/cli/new/templates/app/code/client.jax.py.tpl +50 -0
  23. flwr/cli/new/templates/app/code/client.mlx.py.tpl +73 -0
  24. flwr/cli/new/templates/app/code/client.numpy.py.tpl +7 -7
  25. flwr/cli/new/templates/app/code/client.pytorch.py.tpl +30 -21
  26. flwr/cli/new/templates/app/code/client.sklearn.py.tpl +63 -0
  27. flwr/cli/new/templates/app/code/client.tensorflow.py.tpl +57 -1
  28. flwr/cli/new/templates/app/code/dataset.baseline.py.tpl +36 -0
  29. flwr/cli/new/templates/app/code/flwr_tune/__init__.py +15 -0
  30. flwr/cli/new/templates/app/code/flwr_tune/client_app.py.tpl +126 -0
  31. flwr/cli/new/templates/app/code/flwr_tune/dataset.py.tpl +87 -0
  32. flwr/cli/new/templates/app/code/flwr_tune/models.py.tpl +78 -0
  33. flwr/cli/new/templates/app/code/flwr_tune/server_app.py.tpl +94 -0
  34. flwr/cli/new/templates/app/code/flwr_tune/strategy.py.tpl +83 -0
  35. flwr/cli/new/templates/app/code/model.baseline.py.tpl +80 -0
  36. flwr/cli/new/templates/app/code/server.baseline.py.tpl +46 -0
  37. flwr/cli/new/templates/app/code/server.huggingface.py.tpl +38 -0
  38. flwr/cli/new/templates/app/code/server.jax.py.tpl +26 -0
  39. flwr/cli/new/templates/app/code/server.mlx.py.tpl +31 -0
  40. flwr/cli/new/templates/app/code/server.numpy.py.tpl +22 -9
  41. flwr/cli/new/templates/app/code/server.pytorch.py.tpl +21 -18
  42. flwr/cli/new/templates/app/code/server.sklearn.py.tpl +36 -0
  43. flwr/cli/new/templates/app/code/server.tensorflow.py.tpl +29 -1
  44. flwr/cli/new/templates/app/code/strategy.baseline.py.tpl +1 -0
  45. flwr/cli/new/templates/app/code/task.huggingface.py.tpl +102 -0
  46. flwr/cli/new/templates/app/code/task.jax.py.tpl +57 -0
  47. flwr/cli/new/templates/app/code/task.mlx.py.tpl +102 -0
  48. flwr/cli/new/templates/app/code/task.numpy.py.tpl +7 -0
  49. flwr/cli/new/templates/app/code/task.pytorch.py.tpl +29 -24
  50. flwr/cli/new/templates/app/code/task.sklearn.py.tpl +67 -0
  51. flwr/cli/new/templates/app/code/task.tensorflow.py.tpl +53 -0
  52. flwr/cli/new/templates/app/code/utils.baseline.py.tpl +1 -0
  53. flwr/cli/new/templates/app/pyproject.baseline.toml.tpl +138 -0
  54. flwr/cli/new/templates/app/pyproject.flowertune.toml.tpl +68 -0
  55. flwr/cli/new/templates/app/pyproject.huggingface.toml.tpl +46 -0
  56. flwr/cli/new/templates/app/pyproject.jax.toml.tpl +35 -0
  57. flwr/cli/new/templates/app/pyproject.mlx.toml.tpl +39 -0
  58. flwr/cli/new/templates/app/pyproject.numpy.toml.tpl +25 -12
  59. flwr/cli/new/templates/app/pyproject.pytorch.toml.tpl +29 -14
  60. flwr/cli/new/templates/app/pyproject.sklearn.toml.tpl +35 -0
  61. flwr/cli/new/templates/app/pyproject.tensorflow.toml.tpl +29 -14
  62. flwr/cli/run/__init__.py +1 -0
  63. flwr/cli/run/run.py +212 -34
  64. flwr/cli/stop.py +130 -0
  65. flwr/cli/utils.py +240 -5
  66. flwr/client/__init__.py +3 -2
  67. flwr/client/app.py +432 -255
  68. flwr/client/client.py +1 -11
  69. flwr/client/client_app.py +74 -13
  70. flwr/client/clientapp/__init__.py +22 -0
  71. flwr/client/clientapp/app.py +259 -0
  72. flwr/client/clientapp/clientappio_servicer.py +244 -0
  73. flwr/client/clientapp/utils.py +115 -0
  74. flwr/client/dpfedavg_numpy_client.py +7 -8
  75. flwr/client/grpc_adapter_client/__init__.py +15 -0
  76. flwr/client/grpc_adapter_client/connection.py +98 -0
  77. flwr/client/grpc_client/connection.py +21 -7
  78. flwr/client/grpc_rere_client/__init__.py +1 -1
  79. flwr/client/grpc_rere_client/client_interceptor.py +176 -0
  80. flwr/client/grpc_rere_client/connection.py +163 -56
  81. flwr/client/grpc_rere_client/grpc_adapter.py +167 -0
  82. flwr/client/heartbeat.py +74 -0
  83. flwr/client/message_handler/__init__.py +1 -1
  84. flwr/client/message_handler/message_handler.py +10 -11
  85. flwr/client/mod/__init__.py +5 -5
  86. flwr/client/mod/centraldp_mods.py +4 -2
  87. flwr/client/mod/comms_mods.py +5 -4
  88. flwr/client/mod/localdp_mod.py +10 -5
  89. flwr/client/mod/secure_aggregation/__init__.py +1 -1
  90. flwr/client/mod/secure_aggregation/secaggplus_mod.py +26 -26
  91. flwr/client/mod/utils.py +2 -4
  92. flwr/client/nodestate/__init__.py +26 -0
  93. flwr/client/nodestate/in_memory_nodestate.py +38 -0
  94. flwr/client/nodestate/nodestate.py +31 -0
  95. flwr/client/nodestate/nodestate_factory.py +38 -0
  96. flwr/client/numpy_client.py +8 -31
  97. flwr/client/rest_client/__init__.py +1 -1
  98. flwr/client/rest_client/connection.py +199 -176
  99. flwr/client/run_info_store.py +112 -0
  100. flwr/client/supernode/__init__.py +24 -0
  101. flwr/client/supernode/app.py +321 -0
  102. flwr/client/typing.py +1 -0
  103. flwr/common/__init__.py +17 -11
  104. flwr/common/address.py +47 -3
  105. flwr/common/args.py +153 -0
  106. flwr/common/auth_plugin/__init__.py +24 -0
  107. flwr/common/auth_plugin/auth_plugin.py +121 -0
  108. flwr/common/config.py +243 -0
  109. flwr/common/constant.py +135 -1
  110. flwr/common/context.py +32 -2
  111. flwr/common/date.py +22 -4
  112. flwr/common/differential_privacy.py +2 -2
  113. flwr/common/dp.py +2 -4
  114. flwr/common/exit_handlers.py +3 -3
  115. flwr/common/grpc.py +164 -5
  116. flwr/common/logger.py +230 -12
  117. flwr/common/message.py +191 -106
  118. flwr/common/object_ref.py +179 -44
  119. flwr/common/pyproject.py +1 -0
  120. flwr/common/record/__init__.py +2 -1
  121. flwr/common/record/configsrecord.py +58 -18
  122. flwr/common/record/metricsrecord.py +57 -17
  123. flwr/common/record/parametersrecord.py +88 -20
  124. flwr/common/record/recordset.py +153 -30
  125. flwr/common/record/typeddict.py +30 -55
  126. flwr/common/recordset_compat.py +31 -12
  127. flwr/common/retry_invoker.py +123 -30
  128. flwr/common/secure_aggregation/__init__.py +1 -1
  129. flwr/common/secure_aggregation/crypto/__init__.py +1 -1
  130. flwr/common/secure_aggregation/crypto/shamir.py +11 -11
  131. flwr/common/secure_aggregation/crypto/symmetric_encryption.py +68 -4
  132. flwr/common/secure_aggregation/ndarrays_arithmetic.py +17 -17
  133. flwr/common/secure_aggregation/quantization.py +8 -8
  134. flwr/common/secure_aggregation/secaggplus_constants.py +1 -1
  135. flwr/common/secure_aggregation/secaggplus_utils.py +10 -12
  136. flwr/common/serde.py +304 -23
  137. flwr/common/telemetry.py +65 -29
  138. flwr/common/typing.py +120 -19
  139. flwr/common/version.py +17 -3
  140. flwr/proto/clientappio_pb2.py +45 -0
  141. flwr/proto/clientappio_pb2.pyi +132 -0
  142. flwr/proto/clientappio_pb2_grpc.py +135 -0
  143. flwr/proto/clientappio_pb2_grpc.pyi +53 -0
  144. flwr/proto/exec_pb2.py +62 -0
  145. flwr/proto/exec_pb2.pyi +212 -0
  146. flwr/proto/exec_pb2_grpc.py +237 -0
  147. flwr/proto/exec_pb2_grpc.pyi +93 -0
  148. flwr/proto/fab_pb2.py +31 -0
  149. flwr/proto/fab_pb2.pyi +65 -0
  150. flwr/proto/fab_pb2_grpc.py +4 -0
  151. flwr/proto/fab_pb2_grpc.pyi +4 -0
  152. flwr/proto/fleet_pb2.py +42 -23
  153. flwr/proto/fleet_pb2.pyi +123 -1
  154. flwr/proto/fleet_pb2_grpc.py +170 -0
  155. flwr/proto/fleet_pb2_grpc.pyi +61 -0
  156. flwr/proto/grpcadapter_pb2.py +32 -0
  157. flwr/proto/grpcadapter_pb2.pyi +43 -0
  158. flwr/proto/grpcadapter_pb2_grpc.py +66 -0
  159. flwr/proto/grpcadapter_pb2_grpc.pyi +24 -0
  160. flwr/proto/log_pb2.py +29 -0
  161. flwr/proto/log_pb2.pyi +39 -0
  162. flwr/proto/log_pb2_grpc.py +4 -0
  163. flwr/proto/log_pb2_grpc.pyi +4 -0
  164. flwr/proto/message_pb2.py +41 -0
  165. flwr/proto/message_pb2.pyi +128 -0
  166. flwr/proto/message_pb2_grpc.py +4 -0
  167. flwr/proto/message_pb2_grpc.pyi +4 -0
  168. flwr/proto/node_pb2.py +2 -2
  169. flwr/proto/node_pb2.pyi +1 -4
  170. flwr/proto/recordset_pb2.py +35 -33
  171. flwr/proto/recordset_pb2.pyi +40 -14
  172. flwr/proto/run_pb2.py +64 -0
  173. flwr/proto/run_pb2.pyi +268 -0
  174. flwr/proto/run_pb2_grpc.py +4 -0
  175. flwr/proto/run_pb2_grpc.pyi +4 -0
  176. flwr/proto/serverappio_pb2.py +52 -0
  177. flwr/proto/{driver_pb2.pyi → serverappio_pb2.pyi} +62 -20
  178. flwr/proto/serverappio_pb2_grpc.py +410 -0
  179. flwr/proto/serverappio_pb2_grpc.pyi +160 -0
  180. flwr/proto/simulationio_pb2.py +38 -0
  181. flwr/proto/simulationio_pb2.pyi +65 -0
  182. flwr/proto/simulationio_pb2_grpc.py +239 -0
  183. flwr/proto/simulationio_pb2_grpc.pyi +94 -0
  184. flwr/proto/task_pb2.py +7 -8
  185. flwr/proto/task_pb2.pyi +8 -5
  186. flwr/proto/transport_pb2.py +8 -8
  187. flwr/proto/transport_pb2.pyi +9 -6
  188. flwr/server/__init__.py +2 -10
  189. flwr/server/app.py +579 -402
  190. flwr/server/client_manager.py +8 -6
  191. flwr/server/compat/app.py +6 -62
  192. flwr/server/compat/app_utils.py +14 -9
  193. flwr/server/compat/driver_client_proxy.py +25 -59
  194. flwr/server/compat/legacy_context.py +5 -4
  195. flwr/server/driver/__init__.py +2 -0
  196. flwr/server/driver/driver.py +36 -131
  197. flwr/server/driver/grpc_driver.py +220 -81
  198. flwr/server/driver/inmemory_driver.py +183 -0
  199. flwr/server/history.py +28 -29
  200. flwr/server/run_serverapp.py +15 -126
  201. flwr/server/server.py +50 -44
  202. flwr/server/server_app.py +59 -10
  203. flwr/server/serverapp/__init__.py +22 -0
  204. flwr/server/serverapp/app.py +256 -0
  205. flwr/server/serverapp_components.py +52 -0
  206. flwr/server/strategy/__init__.py +2 -2
  207. flwr/server/strategy/aggregate.py +37 -23
  208. flwr/server/strategy/bulyan.py +9 -9
  209. flwr/server/strategy/dp_adaptive_clipping.py +25 -25
  210. flwr/server/strategy/dp_fixed_clipping.py +23 -22
  211. flwr/server/strategy/dpfedavg_adaptive.py +8 -8
  212. flwr/server/strategy/dpfedavg_fixed.py +13 -12
  213. flwr/server/strategy/fault_tolerant_fedavg.py +11 -11
  214. flwr/server/strategy/fedadagrad.py +9 -9
  215. flwr/server/strategy/fedadam.py +20 -10
  216. flwr/server/strategy/fedavg.py +16 -16
  217. flwr/server/strategy/fedavg_android.py +17 -17
  218. flwr/server/strategy/fedavgm.py +9 -9
  219. flwr/server/strategy/fedmedian.py +5 -5
  220. flwr/server/strategy/fedopt.py +6 -6
  221. flwr/server/strategy/fedprox.py +7 -7
  222. flwr/server/strategy/fedtrimmedavg.py +8 -8
  223. flwr/server/strategy/fedxgb_bagging.py +12 -12
  224. flwr/server/strategy/fedxgb_cyclic.py +10 -10
  225. flwr/server/strategy/fedxgb_nn_avg.py +6 -6
  226. flwr/server/strategy/fedyogi.py +9 -9
  227. flwr/server/strategy/krum.py +9 -9
  228. flwr/server/strategy/qfedavg.py +16 -16
  229. flwr/server/strategy/strategy.py +10 -10
  230. flwr/server/superlink/driver/__init__.py +2 -2
  231. flwr/server/superlink/driver/serverappio_grpc.py +61 -0
  232. flwr/server/superlink/driver/serverappio_servicer.py +361 -0
  233. flwr/server/superlink/ffs/__init__.py +24 -0
  234. flwr/server/superlink/ffs/disk_ffs.py +108 -0
  235. flwr/server/superlink/ffs/ffs.py +79 -0
  236. flwr/server/superlink/ffs/ffs_factory.py +47 -0
  237. flwr/server/superlink/fleet/__init__.py +1 -1
  238. flwr/server/superlink/fleet/grpc_adapter/__init__.py +15 -0
  239. flwr/server/superlink/fleet/grpc_adapter/grpc_adapter_servicer.py +162 -0
  240. flwr/server/superlink/fleet/grpc_bidi/__init__.py +1 -1
  241. flwr/server/superlink/fleet/grpc_bidi/flower_service_servicer.py +4 -2
  242. flwr/server/superlink/fleet/grpc_bidi/grpc_bridge.py +3 -2
  243. flwr/server/superlink/fleet/grpc_bidi/grpc_client_proxy.py +1 -1
  244. flwr/server/superlink/fleet/grpc_bidi/grpc_server.py +5 -154
  245. flwr/server/superlink/fleet/grpc_rere/__init__.py +1 -1
  246. flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py +120 -13
  247. flwr/server/superlink/fleet/grpc_rere/server_interceptor.py +228 -0
  248. flwr/server/superlink/fleet/message_handler/__init__.py +1 -1
  249. flwr/server/superlink/fleet/message_handler/message_handler.py +156 -13
  250. flwr/server/superlink/fleet/rest_rere/__init__.py +1 -1
  251. flwr/server/superlink/fleet/rest_rere/rest_api.py +119 -81
  252. flwr/server/superlink/fleet/vce/__init__.py +1 -0
  253. flwr/server/superlink/fleet/vce/backend/__init__.py +4 -4
  254. flwr/server/superlink/fleet/vce/backend/backend.py +8 -9
  255. flwr/server/superlink/fleet/vce/backend/raybackend.py +87 -68
  256. flwr/server/superlink/fleet/vce/vce_api.py +208 -146
  257. flwr/server/superlink/linkstate/__init__.py +28 -0
  258. flwr/server/superlink/linkstate/in_memory_linkstate.py +569 -0
  259. flwr/server/superlink/linkstate/linkstate.py +376 -0
  260. flwr/server/superlink/{state/state_factory.py → linkstate/linkstate_factory.py} +19 -10
  261. flwr/server/superlink/linkstate/sqlite_linkstate.py +1196 -0
  262. flwr/server/superlink/linkstate/utils.py +399 -0
  263. flwr/server/superlink/simulation/__init__.py +15 -0
  264. flwr/server/superlink/simulation/simulationio_grpc.py +65 -0
  265. flwr/server/superlink/simulation/simulationio_servicer.py +186 -0
  266. flwr/server/superlink/utils.py +65 -0
  267. flwr/server/typing.py +2 -0
  268. flwr/server/utils/__init__.py +1 -1
  269. flwr/server/utils/tensorboard.py +5 -5
  270. flwr/server/utils/validator.py +40 -45
  271. flwr/server/workflow/default_workflows.py +70 -26
  272. flwr/server/workflow/secure_aggregation/secagg_workflow.py +1 -0
  273. flwr/server/workflow/secure_aggregation/secaggplus_workflow.py +40 -27
  274. flwr/simulation/__init__.py +12 -5
  275. flwr/simulation/app.py +247 -315
  276. flwr/simulation/legacy_app.py +404 -0
  277. flwr/simulation/ray_transport/__init__.py +1 -1
  278. flwr/simulation/ray_transport/ray_actor.py +42 -67
  279. flwr/simulation/ray_transport/ray_client_proxy.py +37 -17
  280. flwr/simulation/ray_transport/utils.py +1 -0
  281. flwr/simulation/run_simulation.py +306 -163
  282. flwr/simulation/simulationio_connection.py +89 -0
  283. flwr/superexec/__init__.py +15 -0
  284. flwr/superexec/app.py +59 -0
  285. flwr/superexec/deployment.py +188 -0
  286. flwr/superexec/exec_grpc.py +80 -0
  287. flwr/superexec/exec_servicer.py +231 -0
  288. flwr/superexec/exec_user_auth_interceptor.py +101 -0
  289. flwr/superexec/executor.py +96 -0
  290. flwr/superexec/simulation.py +124 -0
  291. {flwr_nightly-1.8.0.dev20240315.dist-info → flwr_nightly-1.15.0.dev20250115.dist-info}/METADATA +33 -26
  292. flwr_nightly-1.15.0.dev20250115.dist-info/RECORD +328 -0
  293. flwr_nightly-1.15.0.dev20250115.dist-info/entry_points.txt +12 -0
  294. flwr/cli/flower_toml.py +0 -140
  295. flwr/cli/new/templates/app/flower.toml.tpl +0 -13
  296. flwr/cli/new/templates/app/requirements.numpy.txt.tpl +0 -2
  297. flwr/cli/new/templates/app/requirements.pytorch.txt.tpl +0 -4
  298. flwr/cli/new/templates/app/requirements.tensorflow.txt.tpl +0 -4
  299. flwr/client/node_state.py +0 -48
  300. flwr/client/node_state_tests.py +0 -65
  301. flwr/proto/driver_pb2.py +0 -44
  302. flwr/proto/driver_pb2_grpc.py +0 -169
  303. flwr/proto/driver_pb2_grpc.pyi +0 -66
  304. flwr/server/superlink/driver/driver_grpc.py +0 -54
  305. flwr/server/superlink/driver/driver_servicer.py +0 -129
  306. flwr/server/superlink/state/in_memory_state.py +0 -230
  307. flwr/server/superlink/state/sqlite_state.py +0 -630
  308. flwr/server/superlink/state/state.py +0 -154
  309. flwr_nightly-1.8.0.dev20240315.dist-info/RECORD +0 -211
  310. flwr_nightly-1.8.0.dev20240315.dist-info/entry_points.txt +0 -9
  311. {flwr_nightly-1.8.0.dev20240315.dist-info → flwr_nightly-1.15.0.dev20250115.dist-info}/LICENSE +0 -0
  312. {flwr_nightly-1.8.0.dev20240315.dist-info → flwr_nightly-1.15.0.dev20250115.dist-info}/WHEEL +0 -0
flwr/common/typing.py CHANGED
@@ -17,15 +17,15 @@
17
17
 
18
18
  from dataclasses import dataclass
19
19
  from enum import Enum
20
- from typing import Any, Callable, Dict, List, Optional, Tuple, Union
20
+ from typing import Any, Callable, Optional, Union
21
21
 
22
22
  import numpy as np
23
23
  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_]
28
- NDArrays = List[NDArray]
27
+ NDArrayFloat = npt.NDArray[np.float64]
28
+ NDArrays = list[NDArray]
29
29
 
30
30
  # The following union type contains Python types corresponding to ProtoBuf types that
31
31
  # ProtoBuf considers to be "Scalar Value Types", even though some of them arguably do
@@ -38,27 +38,31 @@ Value = Union[
38
38
  float,
39
39
  int,
40
40
  str,
41
- List[bool],
42
- List[bytes],
43
- List[float],
44
- List[int],
45
- List[str],
41
+ list[bool],
42
+ list[bytes],
43
+ list[float],
44
+ list[int],
45
+ list[str],
46
46
  ]
47
47
 
48
48
  # Value types for common.MetricsRecord
49
49
  MetricsScalar = Union[int, float]
50
- MetricsScalarList = Union[List[int], List[float]]
50
+ MetricsScalarList = Union[list[int], list[float]]
51
51
  MetricsRecordValues = Union[MetricsScalar, MetricsScalarList]
52
52
  # Value types for common.ConfigsRecord
53
53
  ConfigsScalar = Union[MetricsScalar, str, bytes, bool]
54
- ConfigsScalarList = Union[MetricsScalarList, List[str], List[bytes], List[bool]]
54
+ ConfigsScalarList = Union[MetricsScalarList, list[str], list[bytes], list[bool]]
55
55
  ConfigsRecordValues = Union[ConfigsScalar, ConfigsScalarList]
56
56
 
57
- Metrics = Dict[str, Scalar]
58
- MetricsAggregationFn = Callable[[List[Tuple[int, Metrics]]], Metrics]
57
+ Metrics = dict[str, Scalar]
58
+ MetricsAggregationFn = Callable[[list[tuple[int, Metrics]]], Metrics]
59
59
 
60
- Config = Dict[str, Scalar]
61
- Properties = Dict[str, Scalar]
60
+ Config = dict[str, Scalar]
61
+ Properties = dict[str, Scalar]
62
+
63
+ # Value type for user configs
64
+ UserConfigValue = Union[bool, float, int, str]
65
+ UserConfig = dict[str, UserConfigValue]
62
66
 
63
67
 
64
68
  class Code(Enum):
@@ -79,11 +83,27 @@ class Status:
79
83
  message: str
80
84
 
81
85
 
86
+ class ClientAppOutputCode(Enum):
87
+ """ClientAppIO status codes."""
88
+
89
+ SUCCESS = 0
90
+ DEADLINE_EXCEEDED = 1
91
+ UNKNOWN_ERROR = 2
92
+
93
+
94
+ @dataclass
95
+ class ClientAppOutputStatus:
96
+ """ClientAppIO status."""
97
+
98
+ code: ClientAppOutputCode
99
+ message: str
100
+
101
+
82
102
  @dataclass
83
103
  class Parameters:
84
104
  """Model parameters."""
85
105
 
86
- tensors: List[bytes]
106
+ tensors: list[bytes]
87
107
  tensor_type: str
88
108
 
89
109
 
@@ -107,7 +127,7 @@ class FitIns:
107
127
  """Fit instructions for a client."""
108
128
 
109
129
  parameters: Parameters
110
- config: Dict[str, Scalar]
130
+ config: dict[str, Scalar]
111
131
 
112
132
 
113
133
  @dataclass
@@ -117,7 +137,7 @@ class FitRes:
117
137
  status: Status
118
138
  parameters: Parameters
119
139
  num_examples: int
120
- metrics: Dict[str, Scalar]
140
+ metrics: dict[str, Scalar]
121
141
 
122
142
 
123
143
  @dataclass
@@ -125,7 +145,7 @@ class EvaluateIns:
125
145
  """Evaluate instructions for a client."""
126
146
 
127
147
  parameters: Parameters
128
- config: Dict[str, Scalar]
148
+ config: dict[str, Scalar]
129
149
 
130
150
 
131
151
  @dataclass
@@ -135,7 +155,7 @@ class EvaluateRes:
135
155
  status: Status
136
156
  loss: float
137
157
  num_examples: int
138
- metrics: Dict[str, Scalar]
158
+ metrics: dict[str, Scalar]
139
159
 
140
160
 
141
161
  @dataclass
@@ -185,3 +205,84 @@ class ClientMessage:
185
205
  get_parameters_res: Optional[GetParametersRes] = None
186
206
  fit_res: Optional[FitRes] = None
187
207
  evaluate_res: Optional[EvaluateRes] = None
208
+
209
+
210
+ @dataclass
211
+ class RunStatus:
212
+ """Run status information."""
213
+
214
+ status: str
215
+ sub_status: str
216
+ details: str
217
+
218
+
219
+ @dataclass
220
+ class Run: # pylint: disable=too-many-instance-attributes
221
+ """Run details."""
222
+
223
+ run_id: int
224
+ fab_id: str
225
+ fab_version: str
226
+ fab_hash: str
227
+ override_config: UserConfig
228
+ pending_at: str
229
+ starting_at: str
230
+ running_at: str
231
+ finished_at: str
232
+ status: RunStatus
233
+
234
+ @classmethod
235
+ def create_empty(cls, run_id: int) -> "Run":
236
+ """Return an empty Run instance."""
237
+ return cls(
238
+ run_id=run_id,
239
+ fab_id="",
240
+ fab_version="",
241
+ fab_hash="",
242
+ override_config={},
243
+ pending_at="",
244
+ starting_at="",
245
+ running_at="",
246
+ finished_at="",
247
+ status=RunStatus(status="", sub_status="", details=""),
248
+ )
249
+
250
+
251
+ @dataclass
252
+ class Fab:
253
+ """Fab file representation."""
254
+
255
+ hash_str: str
256
+ content: bytes
257
+
258
+
259
+ class RunNotRunningException(BaseException):
260
+ """Raised when a run is not running."""
261
+
262
+
263
+ class InvalidRunStatusException(BaseException):
264
+ """Raised when an RPC is invalidated by the RunStatus."""
265
+
266
+ def __init__(self, message: str) -> None:
267
+ super().__init__(message)
268
+ self.message = message
269
+
270
+
271
+ # OIDC user authentication types
272
+ @dataclass
273
+ class UserAuthLoginDetails:
274
+ """User authentication login details."""
275
+
276
+ auth_type: str
277
+ device_code: str
278
+ verification_uri_complete: str
279
+ expires_in: int
280
+ interval: int
281
+
282
+
283
+ @dataclass
284
+ class UserAuthCredentials:
285
+ """User authentication tokens."""
286
+
287
+ access_token: str
288
+ refresh_token: str
flwr/common/version.py CHANGED
@@ -1,15 +1,29 @@
1
+ # Copyright 2023 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
+ # ==============================================================================
1
15
  """Flower package version helper."""
2
16
 
17
+
3
18
  import importlib.metadata as importlib_metadata
4
- from typing import Tuple
5
19
 
6
20
 
7
- def _check_package(name: str) -> Tuple[str, str]:
21
+ def _check_package(name: str) -> tuple[str, str]:
8
22
  version: str = importlib_metadata.version(name)
9
23
  return name, version
10
24
 
11
25
 
12
- def _version() -> Tuple[str, str]:
26
+ def _version() -> tuple[str, str]:
13
27
  """Read and return Flower package name and version.
14
28
 
15
29
  Returns
@@ -0,0 +1,45 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: flwr/proto/clientappio.proto
4
+ # Protobuf Python Version: 4.25.0
5
+ """Generated protocol buffer code."""
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import descriptor_pool as _descriptor_pool
8
+ from google.protobuf import symbol_database as _symbol_database
9
+ from google.protobuf.internal import builder as _builder
10
+ # @@protoc_insertion_point(imports)
11
+
12
+ _sym_db = _symbol_database.Default()
13
+
14
+
15
+ from flwr.proto import fab_pb2 as flwr_dot_proto_dot_fab__pb2
16
+ from flwr.proto import run_pb2 as flwr_dot_proto_dot_run__pb2
17
+ from flwr.proto import message_pb2 as flwr_dot_proto_dot_message__pb2
18
+
19
+
20
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1c\x66lwr/proto/clientappio.proto\x12\nflwr.proto\x1a\x14\x66lwr/proto/fab.proto\x1a\x14\x66lwr/proto/run.proto\x1a\x18\x66lwr/proto/message.proto\"W\n\x15\x43lientAppOutputStatus\x12-\n\x04\x63ode\x18\x01 \x01(\x0e\x32\x1f.flwr.proto.ClientAppOutputCode\x12\x0f\n\x07message\x18\x02 \x01(\t\"\x11\n\x0fGetTokenRequest\"!\n\x10GetTokenResponse\x12\r\n\x05token\x18\x01 \x01(\x04\"+\n\x1aPullClientAppInputsRequest\x12\r\n\x05token\x18\x01 \x01(\x04\"\xa5\x01\n\x1bPullClientAppInputsResponse\x12$\n\x07message\x18\x01 \x01(\x0b\x32\x13.flwr.proto.Message\x12$\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x13.flwr.proto.Context\x12\x1c\n\x03run\x18\x03 \x01(\x0b\x32\x0f.flwr.proto.Run\x12\x1c\n\x03\x66\x61\x62\x18\x04 \x01(\x0b\x32\x0f.flwr.proto.Fab\"x\n\x1bPushClientAppOutputsRequest\x12\r\n\x05token\x18\x01 \x01(\x04\x12$\n\x07message\x18\x02 \x01(\x0b\x32\x13.flwr.proto.Message\x12$\n\x07\x63ontext\x18\x03 \x01(\x0b\x32\x13.flwr.proto.Context\"Q\n\x1cPushClientAppOutputsResponse\x12\x31\n\x06status\x18\x01 \x01(\x0b\x32!.flwr.proto.ClientAppOutputStatus*L\n\x13\x43lientAppOutputCode\x12\x0b\n\x07SUCCESS\x10\x00\x12\x15\n\x11\x44\x45\x41\x44LINE_EXCEEDED\x10\x01\x12\x11\n\rUNKNOWN_ERROR\x10\x02\x32\xad\x02\n\x0b\x43lientAppIo\x12G\n\x08GetToken\x12\x1b.flwr.proto.GetTokenRequest\x1a\x1c.flwr.proto.GetTokenResponse\"\x00\x12h\n\x13PullClientAppInputs\x12&.flwr.proto.PullClientAppInputsRequest\x1a\'.flwr.proto.PullClientAppInputsResponse\"\x00\x12k\n\x14PushClientAppOutputs\x12\'.flwr.proto.PushClientAppOutputsRequest\x1a(.flwr.proto.PushClientAppOutputsResponse\"\x00\x62\x06proto3')
21
+
22
+ _globals = globals()
23
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
24
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'flwr.proto.clientappio_pb2', _globals)
25
+ if _descriptor._USE_C_DESCRIPTORS == False:
26
+ DESCRIPTOR._options = None
27
+ _globals['_CLIENTAPPOUTPUTCODE']._serialized_start=675
28
+ _globals['_CLIENTAPPOUTPUTCODE']._serialized_end=751
29
+ _globals['_CLIENTAPPOUTPUTSTATUS']._serialized_start=114
30
+ _globals['_CLIENTAPPOUTPUTSTATUS']._serialized_end=201
31
+ _globals['_GETTOKENREQUEST']._serialized_start=203
32
+ _globals['_GETTOKENREQUEST']._serialized_end=220
33
+ _globals['_GETTOKENRESPONSE']._serialized_start=222
34
+ _globals['_GETTOKENRESPONSE']._serialized_end=255
35
+ _globals['_PULLCLIENTAPPINPUTSREQUEST']._serialized_start=257
36
+ _globals['_PULLCLIENTAPPINPUTSREQUEST']._serialized_end=300
37
+ _globals['_PULLCLIENTAPPINPUTSRESPONSE']._serialized_start=303
38
+ _globals['_PULLCLIENTAPPINPUTSRESPONSE']._serialized_end=468
39
+ _globals['_PUSHCLIENTAPPOUTPUTSREQUEST']._serialized_start=470
40
+ _globals['_PUSHCLIENTAPPOUTPUTSREQUEST']._serialized_end=590
41
+ _globals['_PUSHCLIENTAPPOUTPUTSRESPONSE']._serialized_start=592
42
+ _globals['_PUSHCLIENTAPPOUTPUTSRESPONSE']._serialized_end=673
43
+ _globals['_CLIENTAPPIO']._serialized_start=754
44
+ _globals['_CLIENTAPPIO']._serialized_end=1055
45
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,132 @@
1
+ """
2
+ @generated by mypy-protobuf. Do not edit manually!
3
+ isort:skip_file
4
+ """
5
+ import builtins
6
+ import flwr.proto.fab_pb2
7
+ import flwr.proto.message_pb2
8
+ import flwr.proto.run_pb2
9
+ import google.protobuf.descriptor
10
+ import google.protobuf.internal.enum_type_wrapper
11
+ import google.protobuf.message
12
+ import typing
13
+ import typing_extensions
14
+
15
+ DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
16
+
17
+ class _ClientAppOutputCode:
18
+ ValueType = typing.NewType('ValueType', builtins.int)
19
+ V: typing_extensions.TypeAlias = ValueType
20
+ class _ClientAppOutputCodeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_ClientAppOutputCode.ValueType], builtins.type):
21
+ DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
22
+ SUCCESS: _ClientAppOutputCode.ValueType # 0
23
+ DEADLINE_EXCEEDED: _ClientAppOutputCode.ValueType # 1
24
+ UNKNOWN_ERROR: _ClientAppOutputCode.ValueType # 2
25
+ class ClientAppOutputCode(_ClientAppOutputCode, metaclass=_ClientAppOutputCodeEnumTypeWrapper):
26
+ pass
27
+
28
+ SUCCESS: ClientAppOutputCode.ValueType # 0
29
+ DEADLINE_EXCEEDED: ClientAppOutputCode.ValueType # 1
30
+ UNKNOWN_ERROR: ClientAppOutputCode.ValueType # 2
31
+ global___ClientAppOutputCode = ClientAppOutputCode
32
+
33
+
34
+ class ClientAppOutputStatus(google.protobuf.message.Message):
35
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
36
+ CODE_FIELD_NUMBER: builtins.int
37
+ MESSAGE_FIELD_NUMBER: builtins.int
38
+ code: global___ClientAppOutputCode.ValueType
39
+ message: typing.Text
40
+ def __init__(self,
41
+ *,
42
+ code: global___ClientAppOutputCode.ValueType = ...,
43
+ message: typing.Text = ...,
44
+ ) -> None: ...
45
+ def ClearField(self, field_name: typing_extensions.Literal["code",b"code","message",b"message"]) -> None: ...
46
+ global___ClientAppOutputStatus = ClientAppOutputStatus
47
+
48
+ class GetTokenRequest(google.protobuf.message.Message):
49
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
50
+ def __init__(self,
51
+ ) -> None: ...
52
+ global___GetTokenRequest = GetTokenRequest
53
+
54
+ class GetTokenResponse(google.protobuf.message.Message):
55
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
56
+ TOKEN_FIELD_NUMBER: builtins.int
57
+ token: builtins.int
58
+ def __init__(self,
59
+ *,
60
+ token: builtins.int = ...,
61
+ ) -> None: ...
62
+ def ClearField(self, field_name: typing_extensions.Literal["token",b"token"]) -> None: ...
63
+ global___GetTokenResponse = GetTokenResponse
64
+
65
+ class PullClientAppInputsRequest(google.protobuf.message.Message):
66
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
67
+ TOKEN_FIELD_NUMBER: builtins.int
68
+ token: builtins.int
69
+ def __init__(self,
70
+ *,
71
+ token: builtins.int = ...,
72
+ ) -> None: ...
73
+ def ClearField(self, field_name: typing_extensions.Literal["token",b"token"]) -> None: ...
74
+ global___PullClientAppInputsRequest = PullClientAppInputsRequest
75
+
76
+ class PullClientAppInputsResponse(google.protobuf.message.Message):
77
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
78
+ MESSAGE_FIELD_NUMBER: builtins.int
79
+ CONTEXT_FIELD_NUMBER: builtins.int
80
+ RUN_FIELD_NUMBER: builtins.int
81
+ FAB_FIELD_NUMBER: builtins.int
82
+ @property
83
+ def message(self) -> flwr.proto.message_pb2.Message: ...
84
+ @property
85
+ def context(self) -> flwr.proto.message_pb2.Context: ...
86
+ @property
87
+ def run(self) -> flwr.proto.run_pb2.Run: ...
88
+ @property
89
+ def fab(self) -> flwr.proto.fab_pb2.Fab: ...
90
+ def __init__(self,
91
+ *,
92
+ message: typing.Optional[flwr.proto.message_pb2.Message] = ...,
93
+ context: typing.Optional[flwr.proto.message_pb2.Context] = ...,
94
+ run: typing.Optional[flwr.proto.run_pb2.Run] = ...,
95
+ fab: typing.Optional[flwr.proto.fab_pb2.Fab] = ...,
96
+ ) -> None: ...
97
+ def HasField(self, field_name: typing_extensions.Literal["context",b"context","fab",b"fab","message",b"message","run",b"run"]) -> builtins.bool: ...
98
+ def ClearField(self, field_name: typing_extensions.Literal["context",b"context","fab",b"fab","message",b"message","run",b"run"]) -> None: ...
99
+ global___PullClientAppInputsResponse = PullClientAppInputsResponse
100
+
101
+ class PushClientAppOutputsRequest(google.protobuf.message.Message):
102
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
103
+ TOKEN_FIELD_NUMBER: builtins.int
104
+ MESSAGE_FIELD_NUMBER: builtins.int
105
+ CONTEXT_FIELD_NUMBER: builtins.int
106
+ token: builtins.int
107
+ @property
108
+ def message(self) -> flwr.proto.message_pb2.Message: ...
109
+ @property
110
+ def context(self) -> flwr.proto.message_pb2.Context: ...
111
+ def __init__(self,
112
+ *,
113
+ token: builtins.int = ...,
114
+ message: typing.Optional[flwr.proto.message_pb2.Message] = ...,
115
+ context: typing.Optional[flwr.proto.message_pb2.Context] = ...,
116
+ ) -> None: ...
117
+ def HasField(self, field_name: typing_extensions.Literal["context",b"context","message",b"message"]) -> builtins.bool: ...
118
+ def ClearField(self, field_name: typing_extensions.Literal["context",b"context","message",b"message","token",b"token"]) -> None: ...
119
+ global___PushClientAppOutputsRequest = PushClientAppOutputsRequest
120
+
121
+ class PushClientAppOutputsResponse(google.protobuf.message.Message):
122
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
123
+ STATUS_FIELD_NUMBER: builtins.int
124
+ @property
125
+ def status(self) -> global___ClientAppOutputStatus: ...
126
+ def __init__(self,
127
+ *,
128
+ status: typing.Optional[global___ClientAppOutputStatus] = ...,
129
+ ) -> None: ...
130
+ def HasField(self, field_name: typing_extensions.Literal["status",b"status"]) -> builtins.bool: ...
131
+ def ClearField(self, field_name: typing_extensions.Literal["status",b"status"]) -> None: ...
132
+ global___PushClientAppOutputsResponse = PushClientAppOutputsResponse
@@ -0,0 +1,135 @@
1
+ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2
+ """Client and server classes corresponding to protobuf-defined services."""
3
+ import grpc
4
+
5
+ from flwr.proto import clientappio_pb2 as flwr_dot_proto_dot_clientappio__pb2
6
+
7
+
8
+ class ClientAppIoStub(object):
9
+ """Missing associated documentation comment in .proto file."""
10
+
11
+ def __init__(self, channel):
12
+ """Constructor.
13
+
14
+ Args:
15
+ channel: A grpc.Channel.
16
+ """
17
+ self.GetToken = channel.unary_unary(
18
+ '/flwr.proto.ClientAppIo/GetToken',
19
+ request_serializer=flwr_dot_proto_dot_clientappio__pb2.GetTokenRequest.SerializeToString,
20
+ response_deserializer=flwr_dot_proto_dot_clientappio__pb2.GetTokenResponse.FromString,
21
+ )
22
+ self.PullClientAppInputs = channel.unary_unary(
23
+ '/flwr.proto.ClientAppIo/PullClientAppInputs',
24
+ request_serializer=flwr_dot_proto_dot_clientappio__pb2.PullClientAppInputsRequest.SerializeToString,
25
+ response_deserializer=flwr_dot_proto_dot_clientappio__pb2.PullClientAppInputsResponse.FromString,
26
+ )
27
+ self.PushClientAppOutputs = channel.unary_unary(
28
+ '/flwr.proto.ClientAppIo/PushClientAppOutputs',
29
+ request_serializer=flwr_dot_proto_dot_clientappio__pb2.PushClientAppOutputsRequest.SerializeToString,
30
+ response_deserializer=flwr_dot_proto_dot_clientappio__pb2.PushClientAppOutputsResponse.FromString,
31
+ )
32
+
33
+
34
+ class ClientAppIoServicer(object):
35
+ """Missing associated documentation comment in .proto file."""
36
+
37
+ def GetToken(self, request, context):
38
+ """Get token
39
+ """
40
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
41
+ context.set_details('Method not implemented!')
42
+ raise NotImplementedError('Method not implemented!')
43
+
44
+ def PullClientAppInputs(self, request, context):
45
+ """Get Message, Context, and Run
46
+ """
47
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
48
+ context.set_details('Method not implemented!')
49
+ raise NotImplementedError('Method not implemented!')
50
+
51
+ def PushClientAppOutputs(self, request, context):
52
+ """Send updated Message and Context
53
+ """
54
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
55
+ context.set_details('Method not implemented!')
56
+ raise NotImplementedError('Method not implemented!')
57
+
58
+
59
+ def add_ClientAppIoServicer_to_server(servicer, server):
60
+ rpc_method_handlers = {
61
+ 'GetToken': grpc.unary_unary_rpc_method_handler(
62
+ servicer.GetToken,
63
+ request_deserializer=flwr_dot_proto_dot_clientappio__pb2.GetTokenRequest.FromString,
64
+ response_serializer=flwr_dot_proto_dot_clientappio__pb2.GetTokenResponse.SerializeToString,
65
+ ),
66
+ 'PullClientAppInputs': grpc.unary_unary_rpc_method_handler(
67
+ servicer.PullClientAppInputs,
68
+ request_deserializer=flwr_dot_proto_dot_clientappio__pb2.PullClientAppInputsRequest.FromString,
69
+ response_serializer=flwr_dot_proto_dot_clientappio__pb2.PullClientAppInputsResponse.SerializeToString,
70
+ ),
71
+ 'PushClientAppOutputs': grpc.unary_unary_rpc_method_handler(
72
+ servicer.PushClientAppOutputs,
73
+ request_deserializer=flwr_dot_proto_dot_clientappio__pb2.PushClientAppOutputsRequest.FromString,
74
+ response_serializer=flwr_dot_proto_dot_clientappio__pb2.PushClientAppOutputsResponse.SerializeToString,
75
+ ),
76
+ }
77
+ generic_handler = grpc.method_handlers_generic_handler(
78
+ 'flwr.proto.ClientAppIo', rpc_method_handlers)
79
+ server.add_generic_rpc_handlers((generic_handler,))
80
+
81
+
82
+ # This class is part of an EXPERIMENTAL API.
83
+ class ClientAppIo(object):
84
+ """Missing associated documentation comment in .proto file."""
85
+
86
+ @staticmethod
87
+ def GetToken(request,
88
+ target,
89
+ options=(),
90
+ channel_credentials=None,
91
+ call_credentials=None,
92
+ insecure=False,
93
+ compression=None,
94
+ wait_for_ready=None,
95
+ timeout=None,
96
+ metadata=None):
97
+ return grpc.experimental.unary_unary(request, target, '/flwr.proto.ClientAppIo/GetToken',
98
+ flwr_dot_proto_dot_clientappio__pb2.GetTokenRequest.SerializeToString,
99
+ flwr_dot_proto_dot_clientappio__pb2.GetTokenResponse.FromString,
100
+ options, channel_credentials,
101
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
102
+
103
+ @staticmethod
104
+ def PullClientAppInputs(request,
105
+ target,
106
+ options=(),
107
+ channel_credentials=None,
108
+ call_credentials=None,
109
+ insecure=False,
110
+ compression=None,
111
+ wait_for_ready=None,
112
+ timeout=None,
113
+ metadata=None):
114
+ return grpc.experimental.unary_unary(request, target, '/flwr.proto.ClientAppIo/PullClientAppInputs',
115
+ flwr_dot_proto_dot_clientappio__pb2.PullClientAppInputsRequest.SerializeToString,
116
+ flwr_dot_proto_dot_clientappio__pb2.PullClientAppInputsResponse.FromString,
117
+ options, channel_credentials,
118
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
119
+
120
+ @staticmethod
121
+ def PushClientAppOutputs(request,
122
+ target,
123
+ options=(),
124
+ channel_credentials=None,
125
+ call_credentials=None,
126
+ insecure=False,
127
+ compression=None,
128
+ wait_for_ready=None,
129
+ timeout=None,
130
+ metadata=None):
131
+ return grpc.experimental.unary_unary(request, target, '/flwr.proto.ClientAppIo/PushClientAppOutputs',
132
+ flwr_dot_proto_dot_clientappio__pb2.PushClientAppOutputsRequest.SerializeToString,
133
+ flwr_dot_proto_dot_clientappio__pb2.PushClientAppOutputsResponse.FromString,
134
+ options, channel_credentials,
135
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@@ -0,0 +1,53 @@
1
+ """
2
+ @generated by mypy-protobuf. Do not edit manually!
3
+ isort:skip_file
4
+ """
5
+ import abc
6
+ import flwr.proto.clientappio_pb2
7
+ import grpc
8
+
9
+ class ClientAppIoStub:
10
+ def __init__(self, channel: grpc.Channel) -> None: ...
11
+ GetToken: grpc.UnaryUnaryMultiCallable[
12
+ flwr.proto.clientappio_pb2.GetTokenRequest,
13
+ flwr.proto.clientappio_pb2.GetTokenResponse]
14
+ """Get token"""
15
+
16
+ PullClientAppInputs: grpc.UnaryUnaryMultiCallable[
17
+ flwr.proto.clientappio_pb2.PullClientAppInputsRequest,
18
+ flwr.proto.clientappio_pb2.PullClientAppInputsResponse]
19
+ """Get Message, Context, and Run"""
20
+
21
+ PushClientAppOutputs: grpc.UnaryUnaryMultiCallable[
22
+ flwr.proto.clientappio_pb2.PushClientAppOutputsRequest,
23
+ flwr.proto.clientappio_pb2.PushClientAppOutputsResponse]
24
+ """Send updated Message and Context"""
25
+
26
+
27
+ class ClientAppIoServicer(metaclass=abc.ABCMeta):
28
+ @abc.abstractmethod
29
+ def GetToken(self,
30
+ request: flwr.proto.clientappio_pb2.GetTokenRequest,
31
+ context: grpc.ServicerContext,
32
+ ) -> flwr.proto.clientappio_pb2.GetTokenResponse:
33
+ """Get token"""
34
+ pass
35
+
36
+ @abc.abstractmethod
37
+ def PullClientAppInputs(self,
38
+ request: flwr.proto.clientappio_pb2.PullClientAppInputsRequest,
39
+ context: grpc.ServicerContext,
40
+ ) -> flwr.proto.clientappio_pb2.PullClientAppInputsResponse:
41
+ """Get Message, Context, and Run"""
42
+ pass
43
+
44
+ @abc.abstractmethod
45
+ def PushClientAppOutputs(self,
46
+ request: flwr.proto.clientappio_pb2.PushClientAppOutputsRequest,
47
+ context: grpc.ServicerContext,
48
+ ) -> flwr.proto.clientappio_pb2.PushClientAppOutputsResponse:
49
+ """Send updated Message and Context"""
50
+ pass
51
+
52
+
53
+ def add_ClientAppIoServicer_to_server(servicer: ClientAppIoServicer, server: grpc.Server) -> None: ...
flwr/proto/exec_pb2.py ADDED
@@ -0,0 +1,62 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: flwr/proto/exec.proto
4
+ # Protobuf Python Version: 4.25.0
5
+ """Generated protocol buffer code."""
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import descriptor_pool as _descriptor_pool
8
+ from google.protobuf import symbol_database as _symbol_database
9
+ from google.protobuf.internal import builder as _builder
10
+ # @@protoc_insertion_point(imports)
11
+
12
+ _sym_db = _symbol_database.Default()
13
+
14
+
15
+ from flwr.proto import fab_pb2 as flwr_dot_proto_dot_fab__pb2
16
+ from flwr.proto import transport_pb2 as flwr_dot_proto_dot_transport__pb2
17
+ from flwr.proto import recordset_pb2 as flwr_dot_proto_dot_recordset__pb2
18
+ from flwr.proto import run_pb2 as flwr_dot_proto_dot_run__pb2
19
+
20
+
21
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x66lwr/proto/exec.proto\x12\nflwr.proto\x1a\x14\x66lwr/proto/fab.proto\x1a\x1a\x66lwr/proto/transport.proto\x1a\x1a\x66lwr/proto/recordset.proto\x1a\x14\x66lwr/proto/run.proto\"\xfb\x01\n\x0fStartRunRequest\x12\x1c\n\x03\x66\x61\x62\x18\x01 \x01(\x0b\x32\x0f.flwr.proto.Fab\x12H\n\x0foverride_config\x18\x02 \x03(\x0b\x32/.flwr.proto.StartRunRequest.OverrideConfigEntry\x12\x35\n\x12\x66\x65\x64\x65ration_options\x18\x03 \x01(\x0b\x32\x19.flwr.proto.ConfigsRecord\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\"2\n\x10StartRunResponse\x12\x13\n\x06run_id\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\t\n\x07_run_id\"<\n\x11StreamLogsRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\x12\x17\n\x0f\x61\x66ter_timestamp\x18\x02 \x01(\x01\"B\n\x12StreamLogsResponse\x12\x12\n\nlog_output\x18\x01 \x01(\t\x12\x18\n\x10latest_timestamp\x18\x02 \x01(\x01\"1\n\x0fListRunsRequest\x12\x13\n\x06run_id\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\t\n\x07_run_id\"\x9d\x01\n\x10ListRunsResponse\x12;\n\x08run_dict\x18\x01 \x03(\x0b\x32).flwr.proto.ListRunsResponse.RunDictEntry\x12\x0b\n\x03now\x18\x02 \x01(\t\x1a?\n\x0cRunDictEntry\x12\x0b\n\x03key\x18\x01 \x01(\x04\x12\x1e\n\x05value\x18\x02 \x01(\x0b\x32\x0f.flwr.proto.Run:\x02\x38\x01\"\x18\n\x16GetLoginDetailsRequest\"\x8a\x01\n\x17GetLoginDetailsResponse\x12\x11\n\tauth_type\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65vice_code\x18\x02 \x01(\t\x12!\n\x19verification_uri_complete\x18\x03 \x01(\t\x12\x12\n\nexpires_in\x18\x04 \x01(\x03\x12\x10\n\x08interval\x18\x05 \x01(\x03\"+\n\x14GetAuthTokensRequest\x12\x13\n\x0b\x64\x65vice_code\x18\x01 \x01(\t\"D\n\x15GetAuthTokensResponse\x12\x14\n\x0c\x61\x63\x63\x65ss_token\x18\x01 \x01(\t\x12\x15\n\rrefresh_token\x18\x02 \x01(\t\" \n\x0eStopRunRequest\x12\x0e\n\x06run_id\x18\x01 \x01(\x04\"\"\n\x0fStopRunResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\x32\xe5\x03\n\x04\x45xec\x12G\n\x08StartRun\x12\x1b.flwr.proto.StartRunRequest\x1a\x1c.flwr.proto.StartRunResponse\"\x00\x12\x44\n\x07StopRun\x12\x1a.flwr.proto.StopRunRequest\x1a\x1b.flwr.proto.StopRunResponse\"\x00\x12O\n\nStreamLogs\x12\x1d.flwr.proto.StreamLogsRequest\x1a\x1e.flwr.proto.StreamLogsResponse\"\x00\x30\x01\x12G\n\x08ListRuns\x12\x1b.flwr.proto.ListRunsRequest\x1a\x1c.flwr.proto.ListRunsResponse\"\x00\x12\\\n\x0fGetLoginDetails\x12\".flwr.proto.GetLoginDetailsRequest\x1a#.flwr.proto.GetLoginDetailsResponse\"\x00\x12V\n\rGetAuthTokens\x12 .flwr.proto.GetAuthTokensRequest\x1a!.flwr.proto.GetAuthTokensResponse\"\x00\x62\x06proto3')
22
+
23
+ _globals = globals()
24
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
25
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'flwr.proto.exec_pb2', _globals)
26
+ if _descriptor._USE_C_DESCRIPTORS == False:
27
+ DESCRIPTOR._options = None
28
+ _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._options = None
29
+ _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._serialized_options = b'8\001'
30
+ _globals['_LISTRUNSRESPONSE_RUNDICTENTRY']._options = None
31
+ _globals['_LISTRUNSRESPONSE_RUNDICTENTRY']._serialized_options = b'8\001'
32
+ _globals['_STARTRUNREQUEST']._serialized_start=138
33
+ _globals['_STARTRUNREQUEST']._serialized_end=389
34
+ _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._serialized_start=316
35
+ _globals['_STARTRUNREQUEST_OVERRIDECONFIGENTRY']._serialized_end=389
36
+ _globals['_STARTRUNRESPONSE']._serialized_start=391
37
+ _globals['_STARTRUNRESPONSE']._serialized_end=441
38
+ _globals['_STREAMLOGSREQUEST']._serialized_start=443
39
+ _globals['_STREAMLOGSREQUEST']._serialized_end=503
40
+ _globals['_STREAMLOGSRESPONSE']._serialized_start=505
41
+ _globals['_STREAMLOGSRESPONSE']._serialized_end=571
42
+ _globals['_LISTRUNSREQUEST']._serialized_start=573
43
+ _globals['_LISTRUNSREQUEST']._serialized_end=622
44
+ _globals['_LISTRUNSRESPONSE']._serialized_start=625
45
+ _globals['_LISTRUNSRESPONSE']._serialized_end=782
46
+ _globals['_LISTRUNSRESPONSE_RUNDICTENTRY']._serialized_start=719
47
+ _globals['_LISTRUNSRESPONSE_RUNDICTENTRY']._serialized_end=782
48
+ _globals['_GETLOGINDETAILSREQUEST']._serialized_start=784
49
+ _globals['_GETLOGINDETAILSREQUEST']._serialized_end=808
50
+ _globals['_GETLOGINDETAILSRESPONSE']._serialized_start=811
51
+ _globals['_GETLOGINDETAILSRESPONSE']._serialized_end=949
52
+ _globals['_GETAUTHTOKENSREQUEST']._serialized_start=951
53
+ _globals['_GETAUTHTOKENSREQUEST']._serialized_end=994
54
+ _globals['_GETAUTHTOKENSRESPONSE']._serialized_start=996
55
+ _globals['_GETAUTHTOKENSRESPONSE']._serialized_end=1064
56
+ _globals['_STOPRUNREQUEST']._serialized_start=1066
57
+ _globals['_STOPRUNREQUEST']._serialized_end=1098
58
+ _globals['_STOPRUNRESPONSE']._serialized_start=1100
59
+ _globals['_STOPRUNRESPONSE']._serialized_end=1134
60
+ _globals['_EXEC']._serialized_start=1137
61
+ _globals['_EXEC']._serialized_end=1622
62
+ # @@protoc_insertion_point(module_scope)