flwr-nightly 1.6.0.dev20231030__tar.gz → 1.6.0.dev20231101__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/PKG-INFO +1 -1
  2. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/pyproject.toml +1 -1
  3. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/retry_invoker.py +17 -16
  4. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/LICENSE +0 -0
  5. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/README.md +0 -0
  6. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/__init__.py +0 -0
  7. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/__init__.py +0 -0
  8. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/app.py +0 -0
  9. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/client.py +0 -0
  10. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/dpfedavg_numpy_client.py +0 -0
  11. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/grpc_client/__init__.py +0 -0
  12. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/grpc_client/connection.py +0 -0
  13. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/grpc_rere_client/__init__.py +0 -0
  14. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/grpc_rere_client/connection.py +0 -0
  15. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/message_handler/__init__.py +0 -0
  16. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/message_handler/message_handler.py +0 -0
  17. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/message_handler/task_handler.py +0 -0
  18. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/numpy_client.py +0 -0
  19. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/rest_client/__init__.py +0 -0
  20. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/rest_client/connection.py +0 -0
  21. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/run.py +0 -0
  22. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/secure_aggregation/__init__.py +0 -0
  23. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/secure_aggregation/handler.py +0 -0
  24. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/secure_aggregation/secaggplus_handler.py +0 -0
  25. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/client/typing.py +0 -0
  26. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/__init__.py +0 -0
  27. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/address.py +0 -0
  28. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/constant.py +0 -0
  29. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/date.py +0 -0
  30. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/dp.py +0 -0
  31. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/grpc.py +0 -0
  32. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/logger.py +0 -0
  33. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/parameter.py +0 -0
  34. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/secure_aggregation/__init__.py +0 -0
  35. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/secure_aggregation/crypto/__init__.py +0 -0
  36. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/secure_aggregation/crypto/shamir.py +0 -0
  37. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/secure_aggregation/crypto/symmetric_encryption.py +0 -0
  38. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/secure_aggregation/ndarrays_arithmetic.py +0 -0
  39. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/secure_aggregation/quantization.py +0 -0
  40. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/secure_aggregation/secaggplus_constants.py +0 -0
  41. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/secure_aggregation/secaggplus_utils.py +0 -0
  42. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/serde.py +0 -0
  43. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/telemetry.py +0 -0
  44. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/typing.py +0 -0
  45. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/common/version.py +0 -0
  46. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/driver/__init__.py +0 -0
  47. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/driver/app.py +0 -0
  48. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/driver/driver.py +0 -0
  49. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/driver/driver_client_proxy.py +0 -0
  50. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/driver/grpc_driver.py +0 -0
  51. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/__init__.py +0 -0
  52. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/driver_pb2.py +0 -0
  53. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/driver_pb2.pyi +0 -0
  54. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/driver_pb2_grpc.py +0 -0
  55. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/driver_pb2_grpc.pyi +0 -0
  56. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/fleet_pb2.py +0 -0
  57. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/fleet_pb2.pyi +0 -0
  58. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/fleet_pb2_grpc.py +0 -0
  59. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/fleet_pb2_grpc.pyi +0 -0
  60. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/node_pb2.py +0 -0
  61. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/node_pb2.pyi +0 -0
  62. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/node_pb2_grpc.py +0 -0
  63. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/node_pb2_grpc.pyi +0 -0
  64. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/task_pb2.py +0 -0
  65. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/task_pb2.pyi +0 -0
  66. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/task_pb2_grpc.py +0 -0
  67. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/task_pb2_grpc.pyi +0 -0
  68. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/transport_pb2.py +0 -0
  69. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/transport_pb2.pyi +0 -0
  70. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/transport_pb2_grpc.py +0 -0
  71. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/proto/transport_pb2_grpc.pyi +0 -0
  72. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/py.typed +0 -0
  73. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/__init__.py +0 -0
  74. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/app.py +0 -0
  75. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/client_manager.py +0 -0
  76. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/client_proxy.py +0 -0
  77. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/criterion.py +0 -0
  78. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/driver/__init__.py +0 -0
  79. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/driver/driver_servicer.py +0 -0
  80. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/fleet/__init__.py +0 -0
  81. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/fleet/grpc_bidi/__init__.py +0 -0
  82. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/fleet/grpc_bidi/driver_client_manager.py +0 -0
  83. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/fleet/grpc_bidi/flower_service_servicer.py +0 -0
  84. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/fleet/grpc_bidi/grpc_bridge.py +0 -0
  85. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/fleet/grpc_bidi/grpc_client_proxy.py +0 -0
  86. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/fleet/grpc_bidi/grpc_server.py +0 -0
  87. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/fleet/grpc_bidi/ins_scheduler.py +0 -0
  88. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/fleet/grpc_rere/__init__.py +0 -0
  89. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/fleet/grpc_rere/fleet_servicer.py +0 -0
  90. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/fleet/message_handler/__init__.py +0 -0
  91. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/fleet/message_handler/message_handler.py +0 -0
  92. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/fleet/rest_rere/__init__.py +0 -0
  93. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/fleet/rest_rere/rest_api.py +0 -0
  94. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/history.py +0 -0
  95. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/server.py +0 -0
  96. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/state/__init__.py +0 -0
  97. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/state/in_memory_state.py +0 -0
  98. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/state/sqlite_state.py +0 -0
  99. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/state/state.py +0 -0
  100. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/state/state_factory.py +0 -0
  101. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/__init__.py +0 -0
  102. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/aggregate.py +0 -0
  103. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/dpfedavg_adaptive.py +0 -0
  104. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/dpfedavg_fixed.py +0 -0
  105. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/fault_tolerant_fedavg.py +0 -0
  106. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/fedadagrad.py +0 -0
  107. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/fedadam.py +0 -0
  108. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/fedavg.py +0 -0
  109. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/fedavg_android.py +0 -0
  110. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/fedavgm.py +0 -0
  111. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/fedmedian.py +0 -0
  112. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/fedopt.py +0 -0
  113. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/fedprox.py +0 -0
  114. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/fedtrimmedavg.py +0 -0
  115. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/fedxgb_nn_avg.py +0 -0
  116. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/fedyogi.py +0 -0
  117. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/krum.py +0 -0
  118. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/qfedavg.py +0 -0
  119. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/strategy/strategy.py +0 -0
  120. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/utils/__init__.py +0 -0
  121. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/utils/tensorboard.py +0 -0
  122. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/server/utils/validator.py +0 -0
  123. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/simulation/__init__.py +0 -0
  124. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/simulation/app.py +0 -0
  125. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/simulation/ray_transport/__init__.py +0 -0
  126. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/simulation/ray_transport/ray_actor.py +0 -0
  127. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/src/py/flwr/simulation/ray_transport/ray_client_proxy.py +0 -0
  128. {flwr_nightly-1.6.0.dev20231030 → flwr_nightly-1.6.0.dev20231101}/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.6.0.dev20231030
3
+ Version: 1.6.0.dev20231101
4
4
  Summary: Flower: A Friendly Federated Learning Framework
5
5
  Home-page: https://flower.dev
6
6
  License: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "flwr-nightly"
7
- version = "1.6.0-dev20231030"
7
+ version = "1.6.0-dev20231101"
8
8
  description = "Flower: A Friendly Federated Learning Framework"
9
9
  license = "Apache-2.0"
10
10
  authors = ["The Flower Authors <hello@flower.dev>"]
@@ -107,7 +107,7 @@ class RetryInvoker:
107
107
 
108
108
  Parameters
109
109
  ----------
110
- wait_strategy: Generator[float, None, None]
110
+ wait_factory: Callable[[], Generator[float, None, None]]
111
111
  A generator yielding successive wait times in seconds. If the generator
112
112
  is finite, the giveup event will be triggered when the generator raises
113
113
  `StopIteration`.
@@ -129,11 +129,11 @@ class RetryInvoker:
129
129
  data class object detailing the invocation.
130
130
  on_giveup: Optional[Callable[[RetryState], None]] (default: None)
131
131
  A callable to be executed in the event that `max_tries` or `max_time` is
132
- exceeded, `should_giveup` returns True, or `wait_strategy` generator raises
132
+ exceeded, `should_giveup` returns True, or `wait_factory()` generator raises
133
133
  `StopInteration`. The parameter is a data class object detailing the
134
134
  invocation.
135
135
  jitter: Optional[Callable[[float], float]] (default: full_jitter)
136
- A function of the value yielded by `wait_strategy` returning the actual time
136
+ A function of the value yielded by `wait_factory()` returning the actual time
137
137
  to wait. This function helps distribute wait times stochastically to avoid
138
138
  timing collisions across concurrent clients. Wait times are jittered by
139
139
  default using the `full_jitter` function. To disable jittering, pass
@@ -145,20 +145,20 @@ class RetryInvoker:
145
145
 
146
146
  Examples
147
147
  --------
148
- Initialize a `RetryInvoker` with exponential backoff and call a function:
148
+ Initialize a `RetryInvoker` with exponential backoff and invoke a function:
149
149
 
150
150
  >>> invoker = RetryInvoker(
151
- >>> exponential(),
152
- >>> grpc.RpcError,
153
- >>> max_tries=3,
154
- >>> max_time=None,
155
- >>> )
151
+ ... exponential, # Or use `lambda: exponential(3, 2)` to pass arguments
152
+ ... grpc.RpcError,
153
+ ... max_tries=3,
154
+ ... max_time=None,
155
+ ... )
156
156
  >>> invoker.invoke(my_func, arg1, arg2, kw1=kwarg1)
157
157
  """
158
158
 
159
159
  def __init__(
160
160
  self,
161
- wait_strategy: Generator[float, None, None],
161
+ wait_factory: Callable[[], Generator[float, None, None]],
162
162
  recoverable_exceptions: Union[Type[Exception], Tuple[Type[Exception], ...]],
163
163
  max_tries: Optional[int],
164
164
  max_time: Optional[float],
@@ -169,7 +169,7 @@ class RetryInvoker:
169
169
  jitter: Optional[Callable[[float], float]] = full_jitter,
170
170
  should_giveup: Optional[Callable[[Exception], bool]] = None,
171
171
  ) -> None:
172
- self.wait_strategy = wait_strategy
172
+ self.wait_factory = wait_factory
173
173
  self.recoverable_exceptions = recoverable_exceptions
174
174
  self.max_tries = max_tries
175
175
  self.max_time = max_time
@@ -183,8 +183,8 @@ class RetryInvoker:
183
183
  def invoke(
184
184
  self,
185
185
  target: Callable[..., Any],
186
- *args: Tuple[Any, ...],
187
- **kwargs: Dict[str, Any],
186
+ *args: Any,
187
+ **kwargs: Any,
188
188
  ) -> Any:
189
189
  """Safely invoke the provided callable with retry mechanisms.
190
190
 
@@ -212,12 +212,12 @@ class RetryInvoker:
212
212
  ------
213
213
  Exception
214
214
  If the number of tries exceeds `max_tries`, if the total time
215
- exceeds `max_time`, if `wait_strategy` generator raises `StopInteration`,
215
+ exceeds `max_time`, if `wait_factory()` generator raises `StopInteration`,
216
216
  or if the `should_giveup` returns True for a raised exception.
217
217
 
218
218
  Notes
219
219
  -----
220
- The time between retries is determined by the provided `wait_strategy`
220
+ The time between retries is determined by the provided `wait_factory()`
221
221
  generator and can optionally be jittered using the `jitter` function.
222
222
  The recoverable exceptions that trigger a retry, as well as conditions to
223
223
  stop retries, are also determined by the class's initialization parameters.
@@ -230,6 +230,7 @@ class RetryInvoker:
230
230
  handler(cast(RetryState, ref_state[0]))
231
231
 
232
232
  try_cnt = 0
233
+ wait_generator = self.wait_factory()
233
234
  start = time.time()
234
235
  ref_state: List[Optional[RetryState]] = [None]
235
236
 
@@ -265,7 +266,7 @@ class RetryInvoker:
265
266
  raise
266
267
 
267
268
  try:
268
- wait_time = next(self.wait_strategy)
269
+ wait_time = next(wait_generator)
269
270
  if self.jitter is not None:
270
271
  wait_time = self.jitter(wait_time)
271
272
  if self.max_time is not None: