Skip to content

Commit c30d012

Browse files
authored
Fix retry policy backward compatibility (dstackai#1311)
1 parent 4c03879 commit c30d012

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎src/dstack/_internal/core/models/runs.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
CreationPolicy,
2323
Profile,
2424
ProfileParams,
25+
ProfileRetryPolicy,
2526
RetryEvent,
2627
SpotPolicy,
2728
TerminationPolicy,
@@ -194,6 +195,9 @@ class JobSpec(CoreModel):
194195
registry_auth: Optional[RegistryAuth]
195196
requirements: Requirements
196197
retry: Optional[Retry]
198+
# For backward compatibility with 0.18.x when retry_policy was required.
199+
# TODO: remove in 0.19
200+
retry_policy: ProfileRetryPolicy = ProfileRetryPolicy(retry=False)
197201
working_dir: Optional[str]
198202

199203

‎src/tests/_internal/server/routers/test_runs.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ def get_dev_env_run_plan_dict(
162162
"spot": True,
163163
},
164164
"retry": None,
165+
"retry_policy": {"retry": False, "duration": None},
165166
"working_dir": ".",
166167
},
167168
"offers": [json.loads(o.json()) for o in offers],
@@ -293,6 +294,7 @@ def get_dev_env_run_dict(
293294
"spot": True,
294295
},
295296
"retry": None,
297+
"retry_policy": {"retry": False, "duration": None},
296298
"working_dir": ".",
297299
},
298300
"job_submissions": [

0 commit comments

Comments
 (0)