jolly-florist-66728
11/14/2024, 11:22 PM@task(retries=5)
def get_some_data_from_http() -> List[str]:
edit_map_versions = set()
signed_off_maps = set()
response = requests.get("my url", timeout=20)
if response.status_code != HTTPStatus.OK:
raise Exception("Failed to retrieve data")
# Process and return data....
# Answer
Flyte retries tasks based on the type of error encountered. According to Flyte documentation, Flyte distinguishes between system errors and user errors. System errors, such as network issues, are typically retried automatically. However, user errors, which include exceptions raised in user-defined code, are not retried unless they are subclasses of FlyteRecoverableException
.
In your case, the exception raised when the HTTP request fails is a generic exception, which Flyte treats as a non-recoverable user error. To enable retries, you should raise a FlyteRecoverableException
instead. Would you like more detail on how to implement this change?
Sources:
- Flyte documentation on retries
Slack Link
https://.slack.com/archives/CP2HDHKE1/p1731626545.748649 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.