flwr-nightly 1.8.0.dev20240304__tar.gz → 1.8.0.dev20240306__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/PKG-INFO +4 -3
  2. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/README.md +2 -2
  3. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/pyproject.toml +4 -3
  4. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/app.py +2 -0
  5. flwr_nightly-1.8.0.dev20240306/src/py/flwr/cli/flower_toml.py +151 -0
  6. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/new/new.py +1 -0
  7. flwr_nightly-1.8.0.dev20240306/src/py/flwr/cli/new/templates/app/code/client.numpy.py.tpl +24 -0
  8. flwr_nightly-1.8.0.dev20240306/src/py/flwr/cli/new/templates/app/code/server.numpy.py.tpl +12 -0
  9. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/new/templates/app/flower.toml.tpl +2 -2
  10. flwr_nightly-1.8.0.dev20240306/src/py/flwr/cli/new/templates/app/requirements.numpy.txt.tpl +2 -0
  11. flwr_nightly-1.8.0.dev20240306/src/py/flwr/cli/run/__init__.py +21 -0
  12. flwr_nightly-1.8.0.dev20240306/src/py/flwr/cli/run/run.py +102 -0
  13. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/app.py +93 -8
  14. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/grpc_client/connection.py +16 -14
  15. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/grpc_rere_client/connection.py +14 -4
  16. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/message_handler/message_handler.py +5 -10
  17. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/mod/centraldp_mods.py +5 -5
  18. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/mod/secure_aggregation/secaggplus_mod.py +2 -2
  19. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/rest_client/connection.py +16 -4
  20. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/__init__.py +6 -0
  21. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/constant.py +21 -4
  22. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/app.py +7 -7
  23. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/compat/driver_client_proxy.py +5 -11
  24. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/run_serverapp.py +14 -9
  25. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/server.py +5 -5
  26. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/driver/driver_servicer.py +1 -1
  27. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/vce/vce_api.py +17 -5
  28. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/workflow/default_workflows.py +4 -8
  29. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/simulation/__init__.py +2 -5
  30. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/simulation/ray_transport/ray_client_proxy.py +5 -10
  31. flwr_nightly-1.8.0.dev20240306/src/py/flwr/simulation/run_simulation.py +441 -0
  32. flwr_nightly-1.8.0.dev20240304/src/py/flwr/simulation/run_simulation.py +0 -216
  33. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/LICENSE +0 -0
  34. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/__init__.py +0 -0
  35. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/__init__.py +0 -0
  36. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/example.py +0 -0
  37. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/new/__init__.py +0 -0
  38. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/new/templates/__init__.py +0 -0
  39. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/new/templates/app/README.md.tpl +0 -0
  40. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/new/templates/app/__init__.py +0 -0
  41. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/new/templates/app/code/__init__.py +0 -0
  42. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/new/templates/app/code/__init__.py.tpl +0 -0
  43. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/new/templates/app/code/client.pytorch.py.tpl +0 -0
  44. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/new/templates/app/code/client.tensorflow.py.tpl +0 -0
  45. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/new/templates/app/code/server.pytorch.py.tpl +0 -0
  46. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/new/templates/app/code/server.tensorflow.py.tpl +0 -0
  47. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/new/templates/app/requirements.pytorch.txt.tpl +0 -0
  48. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/new/templates/app/requirements.tensorflow.txt.tpl +0 -0
  49. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/cli/utils.py +0 -0
  50. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/__init__.py +0 -0
  51. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/client.py +0 -0
  52. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/client_app.py +0 -0
  53. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/dpfedavg_numpy_client.py +0 -0
  54. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/grpc_client/__init__.py +0 -0
  55. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/grpc_rere_client/__init__.py +0 -0
  56. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/message_handler/__init__.py +0 -0
  57. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/message_handler/task_handler.py +0 -0
  58. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/mod/__init__.py +0 -0
  59. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/mod/secure_aggregation/__init__.py +0 -0
  60. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/mod/utils.py +0 -0
  61. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/node_state.py +0 -0
  62. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/node_state_tests.py +0 -0
  63. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/numpy_client.py +0 -0
  64. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/rest_client/__init__.py +0 -0
  65. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/client/typing.py +0 -0
  66. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/address.py +0 -0
  67. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/context.py +0 -0
  68. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/date.py +0 -0
  69. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/differential_privacy.py +0 -0
  70. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/differential_privacy_constants.py +0 -0
  71. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/dp.py +0 -0
  72. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/exit_handlers.py +0 -0
  73. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/grpc.py +0 -0
  74. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/logger.py +0 -0
  75. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/message.py +0 -0
  76. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/parameter.py +0 -0
  77. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/record/__init__.py +0 -0
  78. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/record/configsrecord.py +0 -0
  79. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/record/conversion_utils.py +0 -0
  80. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/record/metricsrecord.py +0 -0
  81. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/record/parametersrecord.py +0 -0
  82. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/record/recordset.py +0 -0
  83. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/record/typeddict.py +0 -0
  84. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/recordset_compat.py +0 -0
  85. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/retry_invoker.py +0 -0
  86. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/secure_aggregation/__init__.py +0 -0
  87. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/secure_aggregation/crypto/__init__.py +0 -0
  88. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/secure_aggregation/crypto/shamir.py +0 -0
  89. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/secure_aggregation/crypto/symmetric_encryption.py +0 -0
  90. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/secure_aggregation/ndarrays_arithmetic.py +0 -0
  91. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/secure_aggregation/quantization.py +0 -0
  92. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/secure_aggregation/secaggplus_constants.py +0 -0
  93. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/secure_aggregation/secaggplus_utils.py +0 -0
  94. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/serde.py +0 -0
  95. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/telemetry.py +0 -0
  96. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/typing.py +0 -0
  97. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/common/version.py +0 -0
  98. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/__init__.py +0 -0
  99. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/driver_pb2.py +0 -0
  100. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/driver_pb2.pyi +0 -0
  101. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/driver_pb2_grpc.py +0 -0
  102. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/driver_pb2_grpc.pyi +0 -0
  103. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/error_pb2.py +0 -0
  104. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/error_pb2.pyi +0 -0
  105. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/error_pb2_grpc.py +0 -0
  106. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/error_pb2_grpc.pyi +0 -0
  107. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/fleet_pb2.py +0 -0
  108. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/fleet_pb2.pyi +0 -0
  109. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/fleet_pb2_grpc.py +0 -0
  110. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/fleet_pb2_grpc.pyi +0 -0
  111. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/node_pb2.py +0 -0
  112. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/node_pb2.pyi +0 -0
  113. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/node_pb2_grpc.py +0 -0
  114. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/node_pb2_grpc.pyi +0 -0
  115. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/recordset_pb2.py +0 -0
  116. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/recordset_pb2.pyi +0 -0
  117. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/recordset_pb2_grpc.py +0 -0
  118. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/recordset_pb2_grpc.pyi +0 -0
  119. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/task_pb2.py +0 -0
  120. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/task_pb2.pyi +0 -0
  121. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/task_pb2_grpc.py +0 -0
  122. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/task_pb2_grpc.pyi +0 -0
  123. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/transport_pb2.py +0 -0
  124. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/transport_pb2.pyi +0 -0
  125. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/transport_pb2_grpc.py +0 -0
  126. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/proto/transport_pb2_grpc.pyi +0 -0
  127. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/py.typed +0 -0
  128. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/__init__.py +0 -0
  129. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/client_manager.py +0 -0
  130. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/client_proxy.py +0 -0
  131. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/compat/__init__.py +0 -0
  132. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/compat/app.py +0 -0
  133. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/compat/app_utils.py +0 -0
  134. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/compat/legacy_context.py +0 -0
  135. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/criterion.py +0 -0
  136. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/driver/__init__.py +0 -0
  137. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/driver/driver.py +0 -0
  138. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/driver/grpc_driver.py +0 -0
  139. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/history.py +0 -0
  140. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/server_app.py +0 -0
  141. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/server_config.py +0 -0
  142. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/__init__.py +0 -0
  143. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/aggregate.py +0 -0
  144. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/bulyan.py +0 -0
  145. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/dp_adaptive_clipping.py +0 -0
  146. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/dp_fixed_clipping.py +0 -0
  147. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/dpfedavg_adaptive.py +0 -0
  148. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/dpfedavg_fixed.py +0 -0
  149. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/fault_tolerant_fedavg.py +0 -0
  150. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/fedadagrad.py +0 -0
  151. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/fedadam.py +0 -0
  152. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/fedavg.py +0 -0
  153. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/fedavg_android.py +0 -0
  154. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/fedavgm.py +0 -0
  155. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/fedmedian.py +0 -0
  156. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/fedopt.py +0 -0
  157. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/fedprox.py +0 -0
  158. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/fedtrimmedavg.py +0 -0
  159. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/fedxgb_bagging.py +0 -0
  160. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/fedxgb_cyclic.py +0 -0
  161. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/fedxgb_nn_avg.py +0 -0
  162. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/fedyogi.py +0 -0
  163. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/krum.py +0 -0
  164. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/qfedavg.py +0 -0
  165. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/strategy/strategy.py +0 -0
  166. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/__init__.py +0 -0
  167. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/driver/__init__.py +0 -0
  168. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/driver/driver_grpc.py +0 -0
  169. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/__init__.py +0 -0
  170. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/grpc_bidi/__init__.py +0 -0
  171. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/grpc_bidi/flower_service_servicer.py +0 -0
  172. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_bridge.py +0 -0
  173. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_client_proxy.py +0 -0
  174. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_server.py +0 -0
  175. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/grpc_rere/__init__.py +0 -0
  176. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py +0 -0
  177. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/message_handler/__init__.py +0 -0
  178. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/message_handler/message_handler.py +0 -0
  179. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/rest_rere/__init__.py +0 -0
  180. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/rest_rere/rest_api.py +0 -0
  181. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/vce/__init__.py +0 -0
  182. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/vce/backend/__init__.py +0 -0
  183. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/vce/backend/backend.py +0 -0
  184. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/fleet/vce/backend/raybackend.py +0 -0
  185. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/state/__init__.py +0 -0
  186. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/state/in_memory_state.py +0 -0
  187. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/state/sqlite_state.py +0 -0
  188. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/state/state.py +0 -0
  189. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/superlink/state/state_factory.py +0 -0
  190. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/typing.py +0 -0
  191. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/utils/__init__.py +0 -0
  192. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/utils/tensorboard.py +0 -0
  193. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/utils/validator.py +0 -0
  194. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/server/workflow/__init__.py +0 -0
  195. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/simulation/app.py +0 -0
  196. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/simulation/ray_transport/__init__.py +0 -0
  197. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/simulation/ray_transport/ray_actor.py +0 -0
  198. {flwr_nightly-1.8.0.dev20240304 → flwr_nightly-1.8.0.dev20240306}/src/py/flwr/simulation/ray_transport/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flwr-nightly
3
- Version: 1.8.0.dev20240304
3
+ Version: 1.8.0.dev20240306
4
4
  Summary: Flower: A Friendly Federated Learning Framework
5
5
  Home-page: https://flower.ai
6
6
  License: Apache-2.0
@@ -42,6 +42,7 @@ Requires-Dist: pydantic (<2.0.0) ; extra == "simulation"
42
42
  Requires-Dist: ray (==2.6.3) ; extra == "simulation"
43
43
  Requires-Dist: requests (>=2.31.0,<3.0.0) ; extra == "rest"
44
44
  Requires-Dist: starlette (>=0.31.0,<0.32.0) ; extra == "rest"
45
+ Requires-Dist: tomli (>=2.0.1,<3.0.0)
45
46
  Requires-Dist: typer[all] (>=0.9.0,<0.10.0)
46
47
  Requires-Dist: uvicorn[standard] (>=0.23.0,<0.24.0) ; extra == "rest"
47
48
  Project-URL: Documentation, https://flower.ai
@@ -182,7 +183,6 @@ Quickstart examples:
182
183
  - [Quickstart (JAX)](https://github.com/adap/flower/tree/main/examples/quickstart-jax)
183
184
  - [Quickstart (MONAI)](https://github.com/adap/flower/tree/main/examples/quickstart-monai)
184
185
  - [Quickstart (scikit-learn)](https://github.com/adap/flower/tree/main/examples/sklearn-logreg-mnist)
185
- - [Quickstart (XGBoost)](https://github.com/adap/flower/tree/main/examples/xgboost-quickstart)
186
186
  - [Quickstart (Android [TFLite])](https://github.com/adap/flower/tree/main/examples/android)
187
187
  - [Quickstart (iOS [CoreML])](https://github.com/adap/flower/tree/main/examples/ios)
188
188
  - [Quickstart (MLX)](https://github.com/adap/flower/tree/main/examples/quickstart-mlx)
@@ -194,7 +194,8 @@ Other [examples](https://github.com/adap/flower/tree/main/examples):
194
194
  - [PyTorch: From Centralized to Federated](https://github.com/adap/flower/tree/main/examples/pytorch-from-centralized-to-federated)
195
195
  - [Vertical FL](https://github.com/adap/flower/tree/main/examples/vertical-fl)
196
196
  - [Federated Finetuning of OpenAI's Whisper](https://github.com/adap/flower/tree/main/examples/whisper-federated-finetuning)
197
- - [Comprehensive XGBoost](https://github.com/adap/flower/tree/main/examples/xgboost-comprehensive)
197
+ - [Federated Finetuning of Large Language Model](https://github.com/adap/flower/tree/main/examples/fedllm-finetune)
198
+ - [Federated Finetuning of a Vision Transformer](https://github.com/adap/flower/tree/main/examples/vit-finetune)
198
199
  - [Advanced Flower with TensorFlow/Keras](https://github.com/adap/flower/tree/main/examples/advanced-tensorflow)
199
200
  - [Advanced Flower with PyTorch](https://github.com/adap/flower/tree/main/examples/advanced-pytorch)
200
201
  - Single-Machine Simulation of Federated Learning Systems ([PyTorch](https://github.com/adap/flower/tree/main/examples/simulation-pytorch)) ([Tensorflow](https://github.com/adap/flower/tree/main/examples/simulation-tensorflow))
@@ -132,7 +132,6 @@ Quickstart examples:
132
132
  - [Quickstart (JAX)](https://github.com/adap/flower/tree/main/examples/quickstart-jax)
133
133
  - [Quickstart (MONAI)](https://github.com/adap/flower/tree/main/examples/quickstart-monai)
134
134
  - [Quickstart (scikit-learn)](https://github.com/adap/flower/tree/main/examples/sklearn-logreg-mnist)
135
- - [Quickstart (XGBoost)](https://github.com/adap/flower/tree/main/examples/xgboost-quickstart)
136
135
  - [Quickstart (Android [TFLite])](https://github.com/adap/flower/tree/main/examples/android)
137
136
  - [Quickstart (iOS [CoreML])](https://github.com/adap/flower/tree/main/examples/ios)
138
137
  - [Quickstart (MLX)](https://github.com/adap/flower/tree/main/examples/quickstart-mlx)
@@ -144,7 +143,8 @@ Other [examples](https://github.com/adap/flower/tree/main/examples):
144
143
  - [PyTorch: From Centralized to Federated](https://github.com/adap/flower/tree/main/examples/pytorch-from-centralized-to-federated)
145
144
  - [Vertical FL](https://github.com/adap/flower/tree/main/examples/vertical-fl)
146
145
  - [Federated Finetuning of OpenAI's Whisper](https://github.com/adap/flower/tree/main/examples/whisper-federated-finetuning)
147
- - [Comprehensive XGBoost](https://github.com/adap/flower/tree/main/examples/xgboost-comprehensive)
146
+ - [Federated Finetuning of Large Language Model](https://github.com/adap/flower/tree/main/examples/fedllm-finetune)
147
+ - [Federated Finetuning of a Vision Transformer](https://github.com/adap/flower/tree/main/examples/vit-finetune)
148
148
  - [Advanced Flower with TensorFlow/Keras](https://github.com/adap/flower/tree/main/examples/advanced-tensorflow)
149
149
  - [Advanced Flower with PyTorch](https://github.com/adap/flower/tree/main/examples/advanced-pytorch)
150
150
  - Single-Machine Simulation of Federated Learning Systems ([PyTorch](https://github.com/adap/flower/tree/main/examples/simulation-pytorch)) ([Tensorflow](https://github.com/adap/flower/tree/main/examples/simulation-tensorflow))
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "flwr-nightly"
7
- version = "1.8.0-dev20240304"
7
+ version = "1.8.0-dev20240306"
8
8
  description = "Flower: A Friendly Federated Learning Framework"
9
9
  license = "Apache-2.0"
10
10
  authors = ["The Flower Authors <hello@flower.ai>"]
@@ -58,7 +58,7 @@ flower-fleet-api = "flwr.server:run_fleet_api"
58
58
  flower-superlink = "flwr.server:run_superlink"
59
59
  flower-client-app = "flwr.client:run_client_app"
60
60
  flower-server-app = "flwr.server:run_server_app"
61
- flower-simulation = "flwr.simulation:run_simulation"
61
+ flower-simulation = "flwr.simulation:run_simulation_from_cli"
62
62
 
63
63
  [tool.poetry.dependencies]
64
64
  python = "^3.8"
@@ -70,7 +70,8 @@ cryptography = "^42.0.4"
70
70
  pycryptodome = "^3.18.0"
71
71
  iterators = "^0.0.2"
72
72
  typer = { version = "^0.9.0", extras=["all"] }
73
- # Optional dependencies (VCE)
73
+ tomli = "^2.0.1"
74
+ # Optional dependencies (Simulation Engine)
74
75
  ray = { version = "==2.6.3", optional = true }
75
76
  pydantic = { version = "<2.0.0", optional = true }
76
77
  # Optional dependencies (REST transport layer)
@@ -18,6 +18,7 @@ import typer
18
18
 
19
19
  from .example import example
20
20
  from .new import new
21
+ from .run import run
21
22
 
22
23
  app = typer.Typer(
23
24
  help=typer.style(
@@ -30,6 +31,7 @@ app = typer.Typer(
30
31
 
31
32
  app.command()(new)
32
33
  app.command()(example)
34
+ app.command()(run)
33
35
 
34
36
  if __name__ == "__main__":
35
37
  app()
@@ -0,0 +1,151 @@
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
+ """Utility to validate the `flower.toml` file."""
16
+
17
+ import importlib
18
+ import os
19
+ from typing import Any, Dict, List, Optional, Tuple
20
+
21
+ import tomli
22
+
23
+
24
+ def load_flower_toml(path: Optional[str] = None) -> Optional[Dict[str, Any]]:
25
+ """Load flower.toml and return as dict."""
26
+ if path is None:
27
+ cur_dir = os.getcwd()
28
+ toml_path = os.path.join(cur_dir, "flower.toml")
29
+ else:
30
+ toml_path = path
31
+
32
+ if not os.path.isfile(toml_path):
33
+ return None
34
+
35
+ with open(toml_path, encoding="utf-8") as toml_file:
36
+ data = tomli.loads(toml_file.read())
37
+ return data
38
+
39
+
40
+ def validate_flower_toml_fields(
41
+ config: Dict[str, Any]
42
+ ) -> Tuple[bool, List[str], List[str]]:
43
+ """Validate flower.toml fields."""
44
+ errors = []
45
+ warnings = []
46
+
47
+ if "project" not in config:
48
+ errors.append("Missing [project] section")
49
+ else:
50
+ if "name" not in config["project"]:
51
+ errors.append('Property "name" missing in [project]')
52
+ if "version" not in config["project"]:
53
+ errors.append('Property "version" missing in [project]')
54
+ if "description" not in config["project"]:
55
+ warnings.append('Recommended property "description" missing in [project]')
56
+ if "license" not in config["project"]:
57
+ warnings.append('Recommended property "license" missing in [project]')
58
+ if "authors" not in config["project"]:
59
+ warnings.append('Recommended property "authors" missing in [project]')
60
+
61
+ if "flower" not in config:
62
+ errors.append("Missing [flower] section")
63
+ elif "components" not in config["flower"]:
64
+ errors.append("Missing [flower.components] section")
65
+ else:
66
+ if "serverapp" not in config["flower"]["components"]:
67
+ errors.append('Property "serverapp" missing in [flower.components]')
68
+ if "clientapp" not in config["flower"]["components"]:
69
+ errors.append('Property "clientapp" missing in [flower.components]')
70
+
71
+ return len(errors) == 0, errors, warnings
72
+
73
+
74
+ def validate_object_reference(ref: str) -> Tuple[bool, Optional[str]]:
75
+ """Validate object reference.
76
+
77
+ Returns
78
+ -------
79
+ Tuple[bool, Optional[str]]
80
+ A boolean indicating whether an object reference is valid and
81
+ the reason why it might not be.
82
+ """
83
+ module_str, _, attributes_str = ref.partition(":")
84
+ if not module_str:
85
+ return (
86
+ False,
87
+ f"Missing module in {ref}",
88
+ )
89
+ if not attributes_str:
90
+ return (
91
+ False,
92
+ f"Missing attribute in {ref}",
93
+ )
94
+
95
+ # Load module
96
+ try:
97
+ module = importlib.import_module(module_str)
98
+ except ModuleNotFoundError:
99
+ return False, f"Unable to load module {module_str}"
100
+
101
+ # Recursively load attribute
102
+ attribute = module
103
+ try:
104
+ for attribute_str in attributes_str.split("."):
105
+ attribute = getattr(attribute, attribute_str)
106
+ except AttributeError:
107
+ return (
108
+ False,
109
+ f"Unable to load attribute {attributes_str} from module {module_str}",
110
+ )
111
+
112
+ return (True, None)
113
+
114
+
115
+ def validate_flower_toml(config: Dict[str, Any]) -> Tuple[bool, List[str], List[str]]:
116
+ """Validate flower.toml."""
117
+ is_valid, errors, warnings = validate_flower_toml_fields(config)
118
+
119
+ if not is_valid:
120
+ return False, errors, warnings
121
+
122
+ # Validate serverapp
123
+ is_valid, reason = validate_object_reference(
124
+ config["flower"]["components"]["serverapp"]
125
+ )
126
+ if not is_valid and isinstance(reason, str):
127
+ return False, [reason], []
128
+
129
+ # Validate clientapp
130
+ is_valid, reason = validate_object_reference(
131
+ config["flower"]["components"]["clientapp"]
132
+ )
133
+
134
+ if not is_valid and isinstance(reason, str):
135
+ return False, [reason], []
136
+
137
+ return True, [], []
138
+
139
+
140
+ def apply_defaults(
141
+ config: Dict[str, Any],
142
+ defaults: Dict[str, Any],
143
+ ) -> Dict[str, Any]:
144
+ """Apply defaults to config."""
145
+ for key in defaults:
146
+ if key in config:
147
+ if isinstance(config[key], dict) and isinstance(defaults[key], dict):
148
+ apply_defaults(config[key], defaults[key])
149
+ else:
150
+ config[key] = defaults[key]
151
+ return config
@@ -28,6 +28,7 @@ from ..utils import prompt_options
28
28
  class MlFramework(str, Enum):
29
29
  """Available frameworks."""
30
30
 
31
+ NUMPY = "NumPy"
31
32
  PYTORCH = "PyTorch"
32
33
  TENSORFLOW = "TensorFlow"
33
34
 
@@ -0,0 +1,24 @@
1
+ """$project_name: A Flower / NumPy app."""
2
+
3
+ import flwr as fl
4
+ import numpy as np
5
+
6
+
7
+ # Flower client, adapted from Pytorch quickstart example
8
+ class FlowerClient(fl.client.NumPyClient):
9
+ def get_parameters(self, config):
10
+ return [np.ones((1, 1))]
11
+
12
+ def fit(self, parameters, config):
13
+ return ([np.ones((1, 1))], 1, {})
14
+
15
+ def evaluate(self, parameters, config):
16
+ return float(0.0), 1, {"accuracy": float(1.0)}
17
+
18
+
19
+ def client_fn(cid: str):
20
+ return FlowerClient().to_client()
21
+
22
+
23
+ # ClientApp for Flower-Next
24
+ app = fl.client.ClientApp(client_fn=client_fn)
@@ -0,0 +1,12 @@
1
+ """$project_name: A Flower / NumPy app."""
2
+
3
+ import flwr as fl
4
+
5
+ # Configure the strategy
6
+ strategy = fl.server.strategy.FedAvg()
7
+
8
+ # Flower ServerApp
9
+ app = fl.server.ServerApp(
10
+ config=fl.server.ServerConfig(num_rounds=1),
11
+ strategy=strategy,
12
+ )
@@ -1,10 +1,10 @@
1
- [flower]
1
+ [project]
2
2
  name = "$project_name"
3
3
  version = "1.0.0"
4
4
  description = ""
5
5
  license = "Apache-2.0"
6
6
  authors = ["The Flower Authors <hello@flower.ai>"]
7
7
 
8
- [components]
8
+ [flower.components]
9
9
  serverapp = "$project_name.server:app"
10
10
  clientapp = "$project_name.client:app"
@@ -0,0 +1,2 @@
1
+ flwr>=1.8, <2.0
2
+ numpy >= 1.21.0
@@ -0,0 +1,21 @@
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
+ """Flower command line interface `run` command."""
16
+
17
+ from .run import run as run
18
+
19
+ __all__ = [
20
+ "run",
21
+ ]
@@ -0,0 +1,102 @@
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
+ """Flower command line interface `run` command."""
16
+
17
+ import sys
18
+
19
+ import typer
20
+
21
+ from flwr.cli.flower_toml import apply_defaults, load_flower_toml, validate_flower_toml
22
+ from flwr.simulation.run_simulation import _run_simulation
23
+
24
+
25
+ def run() -> None:
26
+ """Run Flower project."""
27
+ print(
28
+ typer.style("Loading project configuration... ", fg=typer.colors.BLUE),
29
+ end="",
30
+ )
31
+ config = load_flower_toml()
32
+ if not config:
33
+ print(
34
+ typer.style(
35
+ "Project configuration could not be loaded. "
36
+ "flower.toml does not exist.",
37
+ fg=typer.colors.RED,
38
+ bold=True,
39
+ )
40
+ )
41
+ sys.exit()
42
+ print(typer.style("Success", fg=typer.colors.GREEN))
43
+
44
+ print(
45
+ typer.style("Validating project configuration... ", fg=typer.colors.BLUE),
46
+ end="",
47
+ )
48
+ is_valid, errors, warnings = validate_flower_toml(config)
49
+ if warnings:
50
+ print(
51
+ typer.style(
52
+ "Project configuration is missing the following "
53
+ "recommended properties:\n"
54
+ + "\n".join([f"- {line}" for line in warnings]),
55
+ fg=typer.colors.RED,
56
+ bold=True,
57
+ )
58
+ )
59
+
60
+ if not is_valid:
61
+ print(
62
+ typer.style(
63
+ "Project configuration could not be loaded.\nflower.toml is invalid:\n"
64
+ + "\n".join([f"- {line}" for line in errors]),
65
+ fg=typer.colors.RED,
66
+ bold=True,
67
+ )
68
+ )
69
+ sys.exit()
70
+ print(typer.style("Success", fg=typer.colors.GREEN))
71
+
72
+ # Apply defaults
73
+ defaults = {
74
+ "flower": {
75
+ "engine": {"name": "simulation", "simulation": {"super-node": {"num": 100}}}
76
+ }
77
+ }
78
+ config = apply_defaults(config, defaults)
79
+
80
+ server_app_ref = config["flower"]["components"]["serverapp"]
81
+ client_app_ref = config["flower"]["components"]["clientapp"]
82
+ engine = config["flower"]["engine"]["name"]
83
+
84
+ if engine == "simulation":
85
+ num_supernodes = config["flower"]["engine"]["simulation"]["super-node"]["num"]
86
+
87
+ print(
88
+ typer.style("Starting run... ", fg=typer.colors.BLUE),
89
+ )
90
+ _run_simulation(
91
+ server_app_attr=server_app_ref,
92
+ client_app_attr=client_app_ref,
93
+ num_supernodes=num_supernodes,
94
+ )
95
+ else:
96
+ print(
97
+ typer.style(
98
+ f"Engine '{engine}' is not yet supported in `flwr run`",
99
+ fg=typer.colors.RED,
100
+ bold=True,
101
+ )
102
+ )
@@ -20,7 +20,9 @@ import sys
20
20
  import time
21
21
  from logging import DEBUG, INFO, WARN
22
22
  from pathlib import Path
23
- from typing import Callable, ContextManager, Optional, Tuple, Union
23
+ from typing import Callable, ContextManager, Optional, Tuple, Type, Union
24
+
25
+ from grpc import RpcError
24
26
 
25
27
  from flwr.client.client import Client
26
28
  from flwr.client.client_app import ClientApp
@@ -36,6 +38,7 @@ from flwr.common.constant import (
36
38
  )
37
39
  from flwr.common.exit_handlers import register_exit_handlers
38
40
  from flwr.common.logger import log, warn_deprecated_feature, warn_experimental_feature
41
+ from flwr.common.retry_invoker import RetryInvoker, exponential
39
42
 
40
43
  from .client_app import load_client_app
41
44
  from .grpc_client.connection import grpc_connection
@@ -104,6 +107,8 @@ def run_client_app() -> None:
104
107
  transport="rest" if args.rest else "grpc-rere",
105
108
  root_certificates=root_certificates,
106
109
  insecure=args.insecure,
110
+ max_retries=args.max_retries,
111
+ max_wait_time=args.max_wait_time,
107
112
  )
108
113
  register_exit_handlers(event_type=EventType.RUN_CLIENT_APP_LEAVE)
109
114
 
@@ -141,6 +146,22 @@ def _parse_args_run_client_app() -> argparse.ArgumentParser:
141
146
  default="0.0.0.0:9092",
142
147
  help="Server address",
143
148
  )
149
+ parser.add_argument(
150
+ "--max-retries",
151
+ type=int,
152
+ default=None,
153
+ help="The maximum number of times the client will try to connect to the"
154
+ "server before giving up in case of a connection error. By default,"
155
+ "it is set to None, meaning there is no limit to the number of tries.",
156
+ )
157
+ parser.add_argument(
158
+ "--max-wait-time",
159
+ type=float,
160
+ default=None,
161
+ help="The maximum duration before the client stops trying to"
162
+ "connect to the server in case of connection error. By default, it"
163
+ "is set to None, meaning there is no limit to the total time.",
164
+ )
144
165
  parser.add_argument(
145
166
  "--dir",
146
167
  default="",
@@ -180,6 +201,8 @@ def start_client(
180
201
  root_certificates: Optional[Union[bytes, str]] = None,
181
202
  insecure: Optional[bool] = None,
182
203
  transport: Optional[str] = None,
204
+ max_retries: Optional[int] = None,
205
+ max_wait_time: Optional[float] = None,
183
206
  ) -> None:
184
207
  """Start a Flower client node which connects to a Flower server.
185
208
 
@@ -213,6 +236,14 @@ def start_client(
213
236
  - 'grpc-bidi': gRPC, bidirectional streaming
214
237
  - 'grpc-rere': gRPC, request-response (experimental)
215
238
  - 'rest': HTTP (experimental)
239
+ max_retries: Optional[int] (default: None)
240
+ The maximum number of times the client will try to connect to the
241
+ server before giving up in case of a connection error. If set to None,
242
+ there is no limit to the number of tries.
243
+ max_wait_time: Optional[float] (default: None)
244
+ The maximum duration before the client stops trying to
245
+ connect to the server in case of connection error.
246
+ If set to None, there is no limit to the total time.
216
247
 
217
248
  Examples
218
249
  --------
@@ -254,6 +285,8 @@ def start_client(
254
285
  root_certificates=root_certificates,
255
286
  insecure=insecure,
256
287
  transport=transport,
288
+ max_retries=max_retries,
289
+ max_wait_time=max_wait_time,
257
290
  )
258
291
  event(EventType.START_CLIENT_LEAVE)
259
292
 
@@ -272,6 +305,8 @@ def _start_client_internal(
272
305
  root_certificates: Optional[Union[bytes, str]] = None,
273
306
  insecure: Optional[bool] = None,
274
307
  transport: Optional[str] = None,
308
+ max_retries: Optional[int] = None,
309
+ max_wait_time: Optional[float] = None,
275
310
  ) -> None:
276
311
  """Start a Flower client node which connects to a Flower server.
277
312
 
@@ -299,7 +334,7 @@ def _start_client_internal(
299
334
  The PEM-encoded root certificates as a byte string or a path string.
300
335
  If provided, a secure connection using the certificates will be
301
336
  established to an SSL-enabled Flower server.
302
- insecure : bool (default: True)
337
+ insecure : Optional[bool] (default: None)
303
338
  Starts an insecure gRPC connection when True. Enables HTTPS connection
304
339
  when False, using system certificates if `root_certificates` is None.
305
340
  transport : Optional[str] (default: None)
@@ -307,6 +342,14 @@ def _start_client_internal(
307
342
  - 'grpc-bidi': gRPC, bidirectional streaming
308
343
  - 'grpc-rere': gRPC, request-response (experimental)
309
344
  - 'rest': HTTP (experimental)
345
+ max_retries: Optional[int] (default: None)
346
+ The maximum number of times the client will try to connect to the
347
+ server before giving up in case of a connection error. If set to None,
348
+ there is no limit to the number of tries.
349
+ max_wait_time: Optional[float] (default: None)
350
+ The maximum duration before the client stops trying to
351
+ connect to the server in case of connection error.
352
+ If set to None, there is no limit to the total time.
310
353
  """
311
354
  if insecure is None:
312
355
  insecure = root_certificates is None
@@ -338,7 +381,45 @@ def _start_client_internal(
338
381
  # Both `client` and `client_fn` must not be used directly
339
382
 
340
383
  # Initialize connection context manager
341
- connection, address = _init_connection(transport, server_address)
384
+ connection, address, connection_error_type = _init_connection(
385
+ transport, server_address
386
+ )
387
+
388
+ retry_invoker = RetryInvoker(
389
+ wait_factory=exponential,
390
+ recoverable_exceptions=connection_error_type,
391
+ max_tries=max_retries,
392
+ max_time=max_wait_time,
393
+ on_giveup=lambda retry_state: (
394
+ log(
395
+ WARN,
396
+ "Giving up reconnection after %.2f seconds and %s tries.",
397
+ retry_state.elapsed_time,
398
+ retry_state.tries,
399
+ )
400
+ if retry_state.tries > 1
401
+ else None
402
+ ),
403
+ on_success=lambda retry_state: (
404
+ log(
405
+ INFO,
406
+ "Connection successful after %.2f seconds and %s tries.",
407
+ retry_state.elapsed_time,
408
+ retry_state.tries,
409
+ )
410
+ if retry_state.tries > 1
411
+ else None
412
+ ),
413
+ on_backoff=lambda retry_state: (
414
+ log(WARN, "Connection attempt failed, retrying...")
415
+ if retry_state.tries == 1
416
+ else log(
417
+ DEBUG,
418
+ "Connection attempt failed, retrying in %.2f seconds",
419
+ retry_state.actual_wait,
420
+ )
421
+ ),
422
+ )
342
423
 
343
424
  node_state = NodeState()
344
425
 
@@ -347,6 +428,7 @@ def _start_client_internal(
347
428
  with connection(
348
429
  address,
349
430
  insecure,
431
+ retry_invoker,
350
432
  grpc_max_message_length,
351
433
  root_certificates,
352
434
  ) as conn:
@@ -509,7 +591,7 @@ def start_numpy_client(
509
591
 
510
592
  def _init_connection(transport: Optional[str], server_address: str) -> Tuple[
511
593
  Callable[
512
- [str, bool, int, Union[bytes, str, None]],
594
+ [str, bool, RetryInvoker, int, Union[bytes, str, None]],
513
595
  ContextManager[
514
596
  Tuple[
515
597
  Callable[[], Optional[Message]],
@@ -520,6 +602,7 @@ def _init_connection(transport: Optional[str], server_address: str) -> Tuple[
520
602
  ],
521
603
  ],
522
604
  str,
605
+ Type[Exception],
523
606
  ]:
524
607
  # Parse IP address
525
608
  parsed_address = parse_address(server_address)
@@ -535,6 +618,8 @@ def _init_connection(transport: Optional[str], server_address: str) -> Tuple[
535
618
  # Use either gRPC bidirectional streaming or REST request/response
536
619
  if transport == TRANSPORT_TYPE_REST:
537
620
  try:
621
+ from requests.exceptions import ConnectionError as RequestsConnectionError
622
+
538
623
  from .rest_client.connection import http_request_response
539
624
  except ModuleNotFoundError:
540
625
  sys.exit(MISSING_EXTRA_REST)
@@ -543,14 +628,14 @@ def _init_connection(transport: Optional[str], server_address: str) -> Tuple[
543
628
  "When using the REST API, please provide `https://` or "
544
629
  "`http://` before the server address (e.g. `http://127.0.0.1:8080`)"
545
630
  )
546
- connection = http_request_response
631
+ connection, error_type = http_request_response, RequestsConnectionError
547
632
  elif transport == TRANSPORT_TYPE_GRPC_RERE:
548
- connection = grpc_request_response
633
+ connection, error_type = grpc_request_response, RpcError
549
634
  elif transport == TRANSPORT_TYPE_GRPC_BIDI:
550
- connection = grpc_connection
635
+ connection, error_type = grpc_connection, RpcError
551
636
  else:
552
637
  raise ValueError(
553
638
  f"Unknown transport type: {transport} (possible: {TRANSPORT_TYPES})"
554
639
  )
555
640
 
556
- return connection, address
641
+ return connection, address, error_type