Piotr
07/10/2025, 4:22 PMMarvin
07/10/2025, 4:22 PMMarvin
07/10/2025, 4:23 PMretry_delay_seconds
:
python
@flow(retry_delay_seconds=300) # 5 minute delay
def my_flow():
...
b. More efficiently, use the retries
parameter with persist_result=False
:
python
@flow(
retries=3,
persist_result=False,
retry_delay_seconds=300
)
def my_flow():
...
When using these configurations with a Kubernetes worker:
- The pod will terminate after a failure instead of staying alive
- The Prefect worker will create a new pod when it's time to retry
- This prevents unnecessary resource consumption during retry wait periods
- The work pool quota will only count active pods, not waiting retries
This approach is particularly useful in your self-hosted Kubernetes environment to optimize resource usage and maintain more accurate quota counts.
Note that if you need to preserve logs or other data between retries, you'll need to ensure this information is stored externally (like in your PostgreSQL database or a separate logging system), as the pod will be terminated between retry attempts.Piotr
07/10/2025, 4:25 PMMarvin
07/10/2025, 4:25 PMMarvin
07/10/2025, 4:26 PM