Charles
11/13/2024, 6:27 AMMarvin
11/13/2024, 6:27 AMpersist_result=True
is set, the behavior of not picking up from the last point of failure is something users have noticed.
From the details gathered, several discussions and issues have been around how Prefect 2.x handles retries:
1. Default Behavior: By default, when you retry a flow, it starts from the beginning of the entire task flow. This is seen as it runs tasks even if they had completed successfully prior to the failure. The expectation is the flow would resume from the last failed task, but it doesn't currently work that way (GitHub Issue #10749).
2. Result Persistence: Setting persist_result=True
is meant to store the task results, which would ideally allow for retrying from the point of failure. However, some users note that despite setting this, the behavior remains unchanged (GitHub Issue #9292). It's possibly an implementation aspect that hasn't been fine-tuned in 2.x for all cases.
3. Potential Workarounds: One way users attempt to manage this is by manually setting task states, but again, this doesn't always yield the desired flow resumption exactly at the failure point without re-running preceding steps.
Overall, it might seem like your Prefect setup embodies more optimism than the software's current logic provides in practice for resuming tasks. If this functionality is critical, monitoring Prefect's release notes for any updates or changes in retry logic might be beneficial, or considering contributing to a related issue for visibility on the challenge. Here are some helpful articles and discussions around task management in Prefect.
If you continue facing issues or have further insights, it would be helpful to engage with the Prefect community or monitor related GitHub issues linked above for updates.