retry
frequenz.client.base.retry ¤
Implementations for retry strategies.
Attributes¤
frequenz.client.base.retry.DEFAULT_RETRY_INTERVAL
module-attribute
¤
Default retry interval, in seconds.
frequenz.client.base.retry.DEFAULT_RETRY_JITTER
module-attribute
¤
Default retry jitter, in seconds.
Classes¤
frequenz.client.base.retry.ExponentialBackoff ¤
Bases: Strategy
Provides methods for calculating the exponential interval between retries.
Source code in frequenz/client/base/retry.py
Attributes¤
DEFAULT_INTERVAL
class-attribute
instance-attribute
¤
DEFAULT_INTERVAL = DEFAULT_RETRY_INTERVAL
Default retry interval, in seconds.
DEFAULT_MAX_INTERVAL
class-attribute
instance-attribute
¤
Default maximum retry interval, in seconds.
DEFAULT_MULTIPLIER
class-attribute
instance-attribute
¤
Default multiplier for exponential increment.
Functions¤
__init__ ¤
__init__(
*,
initial_interval: float = DEFAULT_INTERVAL,
max_interval: float = DEFAULT_MAX_INTERVAL,
multiplier: float = DEFAULT_MULTIPLIER,
jitter: float = DEFAULT_RETRY_JITTER,
limit: int | None = None
) -> None
Create a ExponentialBackoff
instance.
PARAMETER | DESCRIPTION |
---|---|
initial_interval |
time to wait for before the first retry, in seconds.
TYPE:
|
max_interval |
maximum interval, in seconds.
TYPE:
|
multiplier |
exponential increment for interval.
TYPE:
|
jitter |
a jitter to add to the retry interval.
TYPE:
|
limit |
max number of retries before giving up.
TYPE:
|
Source code in frequenz/client/base/retry.py
__iter__ ¤
Return an iterator over the retry intervals.
YIELDS | DESCRIPTION |
---|---|
float
|
Next retry interval in seconds. |
get_progress ¤
get_progress() -> str
Return a string denoting the retry progress.
RETURNS | DESCRIPTION |
---|---|
str
|
String denoting retry progress in the form "(count/limit)" |
Source code in frequenz/client/base/retry.py
next_interval ¤
next_interval() -> float | None
Return the time to wait before the next retry.
Returns None
if the retry limit has been reached, and no more retries
are possible.
RETURNS | DESCRIPTION |
---|---|
float | None
|
Time until next retry when below retry limit, and None otherwise. |
Source code in frequenz/client/base/retry.py
frequenz.client.base.retry.LinearBackoff ¤
Bases: Strategy
Provides methods for calculating the interval between retries.
Source code in frequenz/client/base/retry.py
Functions¤
__init__ ¤
__init__(
*,
interval: float = DEFAULT_RETRY_INTERVAL,
jitter: float = DEFAULT_RETRY_JITTER,
limit: int | None = None
) -> None
Create a LinearBackoff
instance.
PARAMETER | DESCRIPTION |
---|---|
interval |
time to wait for before the next retry, in seconds.
TYPE:
|
jitter |
a jitter to add to the retry interval.
TYPE:
|
limit |
max number of retries before giving up.
TYPE:
|
Source code in frequenz/client/base/retry.py
__iter__ ¤
Return an iterator over the retry intervals.
YIELDS | DESCRIPTION |
---|---|
float
|
Next retry interval in seconds. |
get_progress ¤
get_progress() -> str
Return a string denoting the retry progress.
RETURNS | DESCRIPTION |
---|---|
str
|
String denoting retry progress in the form "(count/limit)" |
Source code in frequenz/client/base/retry.py
next_interval ¤
next_interval() -> float | None
Return the time to wait before the next retry.
Returns None
if the retry limit has been reached, and no more retries
are possible.
RETURNS | DESCRIPTION |
---|---|
float | None
|
Time until next retry when below retry limit, and None otherwise. |
Source code in frequenz/client/base/retry.py
frequenz.client.base.retry.Strategy ¤
Bases: ABC
Interface for implementing retry strategies.
Source code in frequenz/client/base/retry.py
Functions¤
__iter__ ¤
Return an iterator over the retry intervals.
YIELDS | DESCRIPTION |
---|---|
float
|
Next retry interval in seconds. |
get_progress ¤
get_progress() -> str
Return a string denoting the retry progress.
RETURNS | DESCRIPTION |
---|---|
str
|
String denoting retry progress in the form "(count/limit)" |
Source code in frequenz/client/base/retry.py
next_interval
abstractmethod
¤
next_interval() -> float | None
Return the time to wait before the next retry.
Returns None
if the retry limit has been reached, and no more retries
are possible.
RETURNS | DESCRIPTION |
---|---|
float | None
|
Time until next retry when below retry limit, and None otherwise. |