flyte icon indicating copy to clipboard operation
flyte copied to clipboard

Implement Retry backoff like https://www.union.ai/docs/v2/union/user-guide/tasks/task-configuration/retries-and-timeouts/#retries-with-exponential-backoff

Open kumare3 opened this issue 1 month ago • 2 comments

kumare3 avatar Oct 08 '26 00:10 kumare3

To implement retry backoff in Flyte, use the flyte.RetryStrategy with a flyte.Backoff policy in your @env.task decorator. This allows you to specify the number of retries, the base delay, the exponential factor, and a cap for the maximum delay. For example:

from datetime import timedelta
import flyte

env = flyte.TaskEnvironment(name="retries")

@env.task(
    retries=flyte.RetryStrategy(
        count=5,
        backoff=flyte.Backoff(
            base=timedelta(seconds=10),  # first retry waits 10s
            factor=2.0,                  # then 20s, 40s, 80s, ...
            cap=timedelta(minutes=5),    # never wait longer than 5m between retries
        ),
    ),
)
async def call_flaky_api() -> str:
    return await fetch_from_flaky_upstream()

The delay before the n-th retry is min(base * factor**n, cap). See Retries with exponential backoff for details.

Would you like a step-by-step explanation or more examples?

Sources:


This is an AI-generated response and your feedback is appreciated! Please leave a 👍 if this is helpful and 👎 if it is not.

Mention @herald to ask follow-up questions. See runllm.com for more!

runllm avatar Oct 08 '26 00:10 runllm

Closing as a duplicate of #8098, which tracks the same gap (the OSS executor ignores RetryStrategy.backoff). The fix is in #8097: it adds nextAttemptAt to the TaskAction status and waits min(base * factor**n, cap) between user retries.

AdilFayyaz avatar Oct 14 '26 20:10 AdilFayyaz