Skip to content

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)
```

T module-attribute

T = TypeVar('T')

tqdm

tqdm(*args, **kwargs)

Modifies the default function to print output to Output stream.

poll

poll(
    target,
    message=None,
    wait_for=None,
    sleep=5,
    backoff_interval=0.1,
    exponential_rate=3,
)

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.