:thread: on Retry-After
# pacc-nov-19-20-2024
e
🧵 on Retry-After
retry_after.py
@Quentin Churet am I remembering correctly that you asked this question?
q
Ok ! Thank you very much that is exactly this 🙂
🙌 1
But that means you don’t raise an exception
You need to catch your exception and then return the AwaitingRetry state
e
Huh, wait actually looks like there’s even more functionality than I remembered: https://docs.prefect.io/v3/develop/write-tasks#custom-retry-behavior
The
retry_condition_fn
argument accepts a callable that returns a boolean. If the callable returns
True
, the task will be retried. If the callable returns
False
, the task will not be retried. The callable accepts three arguments: the task, the task run, and the state of the task run. The following task will retry on HTTP status codes other than 401 or 404:
Hmm, although that doesn’t let you control the retry delay.
q
Yeah I guess this time you’d need to wait someone using time.sleep