Stéphan Taljaard
05/22/2023, 10:01 AMMarvin
05/22/2023, 10:03 AMpython
from prefect import flow, task
@task(retries=2, retry_delay_seconds=60)
def failure():
print('running')
raise ValueError("bad code")
@flow
def test_retries():
return failure()
In this example, the failure()
task will run a total of three times before the flow fails, with a 60-second delay between retries.
If you need to selectively retry tasks based on specific error types and messages, you might have to implement custom error handling within the task function itself.
Here's the documentation on Flow and Task Retries and Tasks for more information.
I hope this helps, even if it's not the most uplifting news for your error handling needs.