Skip to main content

retry

Task simulating multiple retries.

When return_value is provided, the task after retries returns
the result. Otherwise it fails.
def retry(
self: Task,
return_value: any = None
) - > any

Task simulating multiple retries. When return_value is provided, the task after retries returns the result. Otherwise it fails.

Parameters​

NameTypeDescription
selfTaskThe Celery task instance bound to the function, used to track retry attempts via state attributes.
return_valueany = NoneThe value to be returned upon successful completion of the retry cycle; if None, the task will continue to fail and retry.

Returns​

TypeDescription
anyThe provided return_value after the maximum number of retry attempts (3) has been reached.