@@ -69,6 +69,8 @@ def parse_idle_duration(v: Optional[Union[int, str, bool]]) -> Optional[Union[st
69
69
return parse_duration (v )
70
70
71
71
72
+ # Deprecated in favor of ProfileRetry().
73
+ # TODO: Remove when no longer referenced.
72
74
class ProfileRetryPolicy (CoreModel ):
73
75
retry : Annotated [bool , Field (description = "Whether to retry the run on failure or not" )] = False
74
76
duration : Annotated [
@@ -95,14 +97,15 @@ class RetryEvent(str, Enum):
95
97
96
98
class ProfileRetry (CoreModel ):
97
99
on_events : Annotated [
98
- List [RetryEvent ],
100
+ Optional [ List [RetryEvent ] ],
99
101
Field (
100
102
description = (
101
103
"The list of events that should be handled with retry."
102
- " Supported events are `no-capacity`, `interruption`, and `error`"
104
+ " Supported events are `no-capacity`, `interruption`, and `error`."
105
+ " Omit to retry on all events"
103
106
)
104
107
),
105
- ]
108
+ ] = None
106
109
duration : Annotated [
107
110
Optional [Union [int , str ]],
108
111
Field (description = "The maximum period of retrying the run, e.g., `4h` or `1d`" ),
@@ -112,7 +115,8 @@ class ProfileRetry(CoreModel):
112
115
113
116
@root_validator
114
117
def _validate_fields (cls , values ):
115
- if "on_events" in values and len (values ["on_events" ]) == 0 :
118
+ on_events = values .get ("on_events" , None )
119
+ if on_events is not None and len (values ["on_events" ]) == 0 :
116
120
raise ValueError ("`on_events` cannot be empty" )
117
121
return values
118
122
@@ -249,8 +253,6 @@ class ProfileParams(CoreModel):
249
253
description = "Deprecated in favor of `idle_duration`" ,
250
254
),
251
255
] = None
252
- # The policy for resubmitting the run. Deprecated in favor of `retry`
253
- retry_policy : Optional [ProfileRetryPolicy ] = None
254
256
255
257
_validate_max_duration = validator ("max_duration" , pre = True , allow_reuse = True )(
256
258
parse_max_duration
0 commit comments