Retry Durable Work¶
Internal implementation module: async_durable_execution._operation.with_retry.
Use with_retry() to retry a block that can contain multiple durable
operations.
Classes¶
WithRetryContext
dataclass
¶
Functions:¶
get_with_retry_context
¶
get_with_retry_context() -> WithRetryContext
Return the active WithRetryContext.
with_retry
¶
with_retry(
func: Callable[[], Awaitable[T]],
*,
name: str | None = None,
retry_strategy: Callable[
[Exception, int], Duration | None
]
| None = None,
serdes: SerDes | None = None,
summary_generator: SummaryGenerator | None = None,
is_virtual: bool = False,
) -> Task[T]
Retry a block of durable logic with configurable backoff.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[[], Awaitable[T]]
|
Async callable to retry. Use get_with_retry_context().attempt inside the callable to access the current attempt number. |
required |
name
|
str | None
|
Optional durable operation name. |
None
|
retry_strategy
|
Callable[[Exception, int], Duration | None] | None
|
Optional strategy that returns a retry delay or None to stop. |
None
|
serdes
|
SerDes | None
|
Optional serializer for the child context result. |
None
|
summary_generator
|
SummaryGenerator | None
|
Optional summary generator for large child results. |
None
|
is_virtual
|
bool
|
Whether the child context should skip lifecycle checkpoints. |
False
|