Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[utils] Add invalid grant to python retry-once errors #12170

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion hail/python/hailtop/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,12 @@ class TransientError(Exception):
pass


RETRY_ONCE_BAD_REQUEST_ERROR_MESSAGES = {
'User project specified in the request is invalid.',
'Invalid grant: account not found',
}


def is_retry_once_error(e):
# An exception is a "retry once error" if a rare, known bug in a dependency or in a cloud
# provider can manifest as this exception *and* that manifestation is indistinguishable from a
Expand All @@ -562,7 +568,7 @@ def is_retry_once_error(e):
and 'azurecr.io' in e.message
and 'not found: manifest unknown: ' in e.message)
if isinstance(e, hailtop.httpx.ClientResponseError):
return e.status == 400 and 'User project specified in the request is invalid.' in e.body
return e.status == 400 and any(msg in e.body for msg in RETRY_ONCE_BAD_REQUEST_ERROR_MESSAGES)
return False


Expand Down