Skip to content

feature: retry decorator improvements #2390

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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

saikonen
Copy link
Collaborator

introduces only_on= to the retry decorator in order to conditionally retry on different types of failures

@saikonen saikonen marked this pull request as ready for review April 30, 2025 14:04
only_on : List[str], default None
List of failure events to retry on. Not specifying values will retry on all known events.
Accepted values are
'step', 'instance-preemption'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be all, instance-preemption. all can be the default value and is the same as the current behavior.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but do we even need the all as a value, as that behaviour should be covered by omitting the attribute completely? is it also not a plausible use-case to retry only on user-code exceptions?

from metaflow import current


class RetryEvents(Enum):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this enum?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its mainly for convenience when building the retry conditions on the executor implemention side, where we need to go through the supported options. Having a literal value to use instead of retyping strings reduces issues with possible typos or renames down the line.

for example this:

RetryEvents.PREEMPT.value in retry_conditions

PREEMPT = "instance-preemption"


PLATFORM_EVICTED_EXITCODE = 234
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed here - since technically we might have many different exit codes depending on the error being caught. also depending on the error backend, the exit codes can be different for the same conceptual failure mode.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to kubernetes / batch respectively. Kept the exit code the same for now as there shouldn't be any conflicts with the current value, but this can be changed as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants