polling
Module to poll different functions.
This module contains function to poll for a specific outcome.
Typical usage example:
```python
poll(wait_for=lambda: not is_reload_in_progress(), sleep=2)
```
poll ¶
Polls wait_for
callable until it returns True.
Parameters:
-
target
(Callable[..., T]
) –Callable to poll target.
-
message
(Optional[Callable[[T], str]]
, default:None
) –Callable that takes target return value as input and transforms it to string displayed in progress bar.
-
wait_for
(Optional[Callable[[T], bool]]
, default:None
) –Callable that takes target return value as input and transforms it to boolean indicating whether polling is finished.
-
sleep
(int
, default:5
) –Time duration to wait between pools.
-
backoff_interval
(float
, default:0.1
) –Exponential backoff interval.
-
exponential_rate
(float
, default:3
) –Exponential backoff rate.