nextmv 0.28.2__py3-none-any.whl → 0.28.3.dev1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nextmv/__about__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "v0.28.2"
1
+ __version__ = "v0.28.3.dev1"
@@ -3174,7 +3174,7 @@ class Application:
3174
3174
  raise ValueError(f"Unknown scenario input type: {scenario.scenario_input.scenario_input_type}")
3175
3175
 
3176
3176
 
3177
- def poll(polling_options: PollingOptions, polling_func: Callable[[], tuple[Any, bool]]) -> Any:
3177
+ def poll(polling_options: PollingOptions, polling_func: Callable[[], tuple[Any, bool]]) -> Any: # noqa: C901
3178
3178
  """
3179
3179
  Poll a function until it succeeds or the polling strategy is exhausted.
3180
3180
 
@@ -3253,6 +3253,7 @@ def poll(polling_options: PollingOptions, polling_func: Callable[[], tuple[Any,
3253
3253
  stopped = False
3254
3254
 
3255
3255
  # Begin the polling process.
3256
+ max_reached = False
3256
3257
  for ix in range(polling_options.max_tries):
3257
3258
  # Check is we should stop polling according to the stop callback.
3258
3259
  if polling_options.stop is not None and polling_options.stop():
@@ -3279,12 +3280,24 @@ def poll(polling_options: PollingOptions, polling_func: Callable[[], tuple[Any,
3279
3280
  )
3280
3281
 
3281
3282
  # Calculate the delay.
3282
- delay = polling_options.delay # Base
3283
- delay += polling_options.backoff * (2**ix) # Add exponential backoff.
3284
- delay += random.uniform(0, polling_options.jitter) # Add jitter.
3283
+ delay = 0.0
3284
+ if max_reached:
3285
+ # If we already reached the maximum, we don't want to further calculate the
3286
+ # delay to avoid overflows.
3287
+ delay = polling_options.max_delay
3288
+ delay += random.uniform(0, polling_options.jitter) # Add jitter.
3289
+ else:
3290
+ delay = polling_options.delay # Base
3291
+ delay += polling_options.backoff * (2**ix) # Add exponential backoff.
3292
+ delay += random.uniform(0, polling_options.jitter) # Add jitter.
3293
+
3294
+ # We cannot exceed the max delay.
3295
+ if delay >= polling_options.max_delay:
3296
+ max_reached = True
3297
+ delay = polling_options.max_delay
3285
3298
 
3286
- # Sleep for the calculated delay. We cannot exceed the max delay.
3287
- sleep_duration = min(delay, polling_options.max_delay)
3299
+ # Sleep for the calculated delay.
3300
+ sleep_duration = delay
3288
3301
  if polling_options.verbose:
3289
3302
  log(f"polling | sleeping for duration: {sleep_duration}")
3290
3303
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nextmv
3
- Version: 0.28.2
3
+ Version: 0.28.3.dev1
4
4
  Summary: The all-purpose Python SDK for Nextmv
5
5
  Project-URL: Homepage, https://www.nextmv.io
6
6
  Project-URL: Documentation, https://www.nextmv.io/docs/python-sdks/nextmv/installation
@@ -1,4 +1,4 @@
1
- nextmv/__about__.py,sha256=OvqMjd7c71S8Psw9qFPqf0MJB6HAZ-JPZ4GnoCdn6SE,24
1
+ nextmv/__about__.py,sha256=qR07ImJh4PgBmUcqUtoxk7xk8BzPgTn_tdkvhweOIMA,29
2
2
  nextmv/__entrypoint__.py,sha256=dA0iwwHtrq6Z9w9FxmxKLoBGLyhe7jWtUAU-Y3PEgHg,1094
3
3
  nextmv/__init__.py,sha256=3E3c3dk4hCR1IXDHZxFDDDK2NPEEO8utwdd9wZ0q6ys,1506
4
4
  nextmv/base_model.py,sha256=qmJ4AsYr9Yv01HQX_BERrn3229gyoZrYyP9tcyqNfeU,2311
@@ -11,7 +11,7 @@ nextmv/output.py,sha256=7s0Io17I7VChQPfqakHj4F2vNV0CD-ANAbE4kqipOXM,37241
11
11
  nextmv/cloud/__init__.py,sha256=7BCh3z-XkbIcMvFHmbj2wA8OquIovjrAZL7O9kA9VZc,3868
12
12
  nextmv/cloud/acceptance_test.py,sha256=Bcfdmh2fkPeBx8FDCngeUo2fjV_LhsUdygnzDQCDbYY,26898
13
13
  nextmv/cloud/account.py,sha256=eukiYQha4U2fkIjg4SgdoawKE1kU5G7GPyDJVrn8hHA,6064
14
- nextmv/cloud/application.py,sha256=Wo4kHRfC2M1bZuv4FzuKLPo1-HJWKEUz38CK931jgUw,110256
14
+ nextmv/cloud/application.py,sha256=yx63cAA60F3PB1Mo0SeELQfzAEFPAoLnZqAUdphkdJA,110719
15
15
  nextmv/cloud/batch_experiment.py,sha256=rD3m-ioE1G8ADYN7afzr7zlq-3H22TNlj9RAh-_ZqIo,7270
16
16
  nextmv/cloud/client.py,sha256=WxnIFZ4sx1yav5SVg9HCexfAqxdDABXkxuMVKjMauvg,15703
17
17
  nextmv/cloud/input_set.py,sha256=2dqmf5z-rZjTKwtBRvnUdfPfKv28It5uTCX0C70uP4Y,4242
@@ -24,7 +24,7 @@ nextmv/cloud/scenario.py,sha256=JRFTDiFBcrgud6wE2qDHUu5oO-Ur3zbPYhhB6ONCxTo,1426
24
24
  nextmv/cloud/secrets.py,sha256=fA5cX0jfTsPVZWV7433wzETGlXpWRLHGswuObx9e6FQ,6820
25
25
  nextmv/cloud/status.py,sha256=blvykRCTCTBkaqH88j4dzdQLhU2v1Ig62-_va98zw20,2789
26
26
  nextmv/cloud/version.py,sha256=5_S7_pWUVBFbvAArku20eK7S645GJcHtgE2OpXLdSzQ,5300
27
- nextmv-0.28.2.dist-info/METADATA,sha256=6qQJh41B_pXGlYilPWKLnN6L3562DlhoLN8g5d_TTGU,15310
28
- nextmv-0.28.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
29
- nextmv-0.28.2.dist-info/licenses/LICENSE,sha256=ZIbK-sSWA-OZprjNbmJAglYRtl5_K4l9UwAV3PGJAPc,11349
30
- nextmv-0.28.2.dist-info/RECORD,,
27
+ nextmv-0.28.3.dev1.dist-info/METADATA,sha256=sUhY7IQXYVFCWiilfkVtJCmPYC5lFBEemtm08Wc1BLE,15315
28
+ nextmv-0.28.3.dev1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
29
+ nextmv-0.28.3.dev1.dist-info/licenses/LICENSE,sha256=ZIbK-sSWA-OZprjNbmJAglYRtl5_K4l9UwAV3PGJAPc,11349
30
+ nextmv-0.28.3.dev1.dist-info/RECORD,,