waiter

An iterable which sleeps for given delays. Aliased as wait.

Usage

Source

waiter()

Parameters

delays iterable | number

any iterable of seconds, or a scalar which is repeated endlessly

timeout number
optional timeout for iteration

Classes

Name Description
Stats Mapping of attempt counts.

Stats

Mapping of attempt counts.

Usage

Source

Stats()
Methods
Name Description
add() Record attempt and return next value.
add()

Record attempt and return next value.

Usage

Source

add(attempt, elapsed)

Methods

Name Description
__add__() Generate incremental backoff.
__aiter__() Asynchronously generate a slow loop of elapsed time.
__ge__() Limit minimum delay generated.
__getitem__() Slice delays, e.g., to limit attempt count.
__iter__() Generate a slow loop of elapsed time.
__le__() Limit maximum delay generated.
__mul__() Generate exponential backoff.
accumulate() Create waiter based on itertools.accumulate.
count() Create waiter based on itertools.count.
exponential() Create waiter with exponential backoff.
fibonacci() Create waiter with fibonacci backoff.
filtered() Generate arg, func(arg) pairs while predicate evaluates to true.
map() Return new waiter with function mapped across delays.
poll() Repeat function call until predicate evaluates to true.
polling() Return a decorator for poll.
polynomial() Create waiter with polynomial backoff.
random() Add random jitter within given range.
repeat() Repeat function call.
repeating() A decorator for repeat.
retry() Repeat function call until exception isn’t raised.
retrying() Return a decorator for retry.
stream() Generate chained values in groups from an iterable.
suppressed() Generate arg, func(arg) pairs while exception isn’t raised.
throttle() Delay iteration.

__add__()

Generate incremental backoff.

Usage

Source

__add__(step)

__aiter__()

Asynchronously generate a slow loop of elapsed time.

Usage

Source

__aiter__()

__ge__()

Limit minimum delay generated.

Usage

Source

__ge__(floor)

__getitem__()

Slice delays, e.g., to limit attempt count.

Usage

Source

__getitem__(slc)

__iter__()

Generate a slow loop of elapsed time.

Usage

Source

__iter__()

__le__()

Limit maximum delay generated.

Usage

Source

__le__(ceiling)

__mul__()

Generate exponential backoff.

Usage

Source

__mul__(factor)

accumulate()

Create waiter based on itertools.accumulate.

Usage

Source

accumulate(*args, **kwargs)

count()

Create waiter based on itertools.count.

Usage

Source

count(*args, **kwargs)

exponential()

Create waiter with exponential backoff.

Usage

Source

exponential(base, **kwargs)

fibonacci()

Create waiter with fibonacci backoff.

Usage

Source

fibonacci(delay, **kwargs)

filtered()

Generate arg, func(arg) pairs while predicate evaluates to true.

Usage

Source

filtered(predicate, func, iterable)

map()

Return new waiter with function mapped across delays.

Usage

Source

map(func, *iterables)

poll()

Repeat function call until predicate evaluates to true.

Usage

Source

poll(predicate, func, *args, **kwargs)

polling()

Return a decorator for poll.

Usage

Source

polling(predicate)

polynomial()

Create waiter with polynomial backoff.

Usage

Source

polynomial(exp, **kwargs)

random()

Add random jitter within given range.

Usage

Source

random(start, stop)

repeat()

Repeat function call.

Usage

Source

repeat(func, *args, **kwargs)

repeating()

A decorator for repeat.

Usage

Source

repeating(func)

retry()

Repeat function call until exception isn’t raised.

Usage

Source

retry(exception, func, *args, **kwargs)

retrying()

Return a decorator for retry.

Usage

Source

retrying(exception)

stream()

Generate chained values in groups from an iterable.

Usage

Source

stream(queue, size=None)

The queue can be extended while in use.


suppressed()

Generate arg, func(arg) pairs while exception isn’t raised.

Usage

Source

suppressed(exception, func, iterable)

throttle()

Delay iteration.

Usage

Source

throttle(iterable)

Async version delays the pull is requested.