File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -278,6 +278,40 @@ def get_artifact_info(self) -> Dict:
278
278
raise ModelArtifactNotFoundError ()
279
279
return {}
280
280
281
+ @check_for_model_id (
282
+ msg = "Model needs to be restored before the archived artifact content can be accessed."
283
+ )
284
+ def restore_archived_model_artifact (
285
+ self , model_id : str , restore_model_for_hours_specified : Optional [int ] = None
286
+ ) -> None :
287
+ """Restores the archived model artifact.
288
+
289
+ Parameters
290
+ ----------
291
+ model_id : str
292
+ The unique identifier of the model to restore.
293
+ restore_model_for_hours_specified : Optional[int]
294
+ The duration (in hours) for which the model should be restored.
295
+
296
+ Returns
297
+ -------
298
+ None
299
+
300
+ Raises
301
+ ------
302
+ ModelArtifactNotFoundError
303
+ If model artifact not found.
304
+ """
305
+ try :
306
+ # Call the underlying client method to restore the model artifact
307
+ return self .client .restore_archived_model_artifact (
308
+ model_id = model_id ,
309
+ restore_model_for_hours_specified = restore_model_for_hours_specified ,
310
+ ).data .content
311
+ except ServiceError as ex :
312
+ if ex .status == 404 :
313
+ raise ModelArtifactNotFoundError ()
314
+
281
315
@check_for_model_id (
282
316
msg = "Model needs to be saved to the Model Catalog before the artifact content can be read."
283
317
)
You can’t perform that action at this time.
0 commit comments