<@ULVA73B9P> do crashed flows automatically retry?
# ask-marvin
a
@Marvin do crashed flows automatically retry?
m
thought for 29.3 seconds
No, flows do not automatically retry when they crash. However, you can implement retry behavior at the task level, which is often more useful as it allows for granular control over which parts of your workflow should retry. Here's how you can implement retries for tasks in your flow:
Copy code
python
from prefect import flow, task

@task(retries=3, retry_delay_seconds=60)  # Will retry up to 3 times, waiting 60 seconds between attempts
def task_that_might_fail():
    # Your potentially unstable operation here
    pass

@flow
def my_flow():
    task_that_might_fail()
You can customize retry behavior with several parameters: - `retries`: Number of retry attempts - `retry_delay_seconds`: Time to wait between retries - `retry_condition_fn`: A custom function to determine if a retry should be attempted If you need flow-level reliability, consider these alternatives: 1. Implement retries at the task level where failures are likely to occur 2. Use Prefect's scheduling features to re-run failed flows 3. Set up monitoring and alerting to handle flow failures appropriately For more details on implementing retries, check out the official documentation on retries.