3636 ModelCustomMetadataItem ,
3737 ModelProvenanceMetadata ,
3838 ModelTaxonomyMetadata ,
39+ ModelBackupSetting ,
40+ ModelRetentionSetting ,
41+ ModelRetentionOperationDetails ,
42+ ModelBackupOperationDetails
3943)
4044from ads .model .service .oci_datascience_model import (
4145 ModelProvenanceNotFoundError ,
@@ -120,6 +124,19 @@ class DataScienceModel(Builder):
120124 Model version id
121125 model_file_description: dict
122126 Contains object path details for models created by reference.
127+ backup_setting: ModelBackupSetting
128+ The value to assign to the backup_setting property of this CreateModelDetails.
129+ retention_setting: ModelRetentionSetting
130+ The value to assign to the retention_setting property of this CreateModelDetails.
131+ retention_operation_details: ModelRetentionOperationDetails
132+ The value to assign to the retention_operation_details property for the Model.
133+ backup_operation_details: ModelBackupOperationDetails
134+ The value to assign to the backup_operation_details property for the Model.
135+
136+
137+
138+
139+
123140
124141 Methods
125142 -------
@@ -178,7 +195,6 @@ class DataScienceModel(Builder):
178195 Sets path details for models created by reference. Input can be either a dict, string or json file and
179196 the schema is dictated by model_file_description_schema.json
180197
181-
182198 Examples
183199 --------
184200 >>> ds_model = (DataScienceModel()
@@ -217,7 +233,12 @@ class DataScienceModel(Builder):
217233 CONST_MODEL_VERSION_ID = "versionId"
218234 CONST_TIME_CREATED = "timeCreated"
219235 CONST_LIFECYCLE_STATE = "lifecycleState"
236+ CONST_LIFECYCLE_DETAILS = "lifecycleDetails"
220237 CONST_MODEL_FILE_DESCRIPTION = "modelDescription"
238+ CONST_BACKUP_SETTING = "backupSetting"
239+ CONST_RETENTION_SETTING = "retentionSetting"
240+ CONST_BACKUP_OPERATION_DETAILS = "backupOperationDetails"
241+ CONST_RETENTION_OPERATION_DETAILS = "retentionOperationDetails"
221242
222243 attribute_map = {
223244 CONST_ID : "id" ,
@@ -239,7 +260,12 @@ class DataScienceModel(Builder):
239260 CONST_MODEL_VERSION_ID : "version_id" ,
240261 CONST_TIME_CREATED : "time_created" ,
241262 CONST_LIFECYCLE_STATE : "lifecycle_state" ,
263+ CONST_LIFECYCLE_DETAILS : "lifecycle_details" ,
242264 CONST_MODEL_FILE_DESCRIPTION : "model_description" ,
265+ CONST_BACKUP_SETTING : "backup_setting" ,
266+ CONST_RETENTION_SETTING : "retention_setting" ,
267+ CONST_BACKUP_OPERATION_DETAILS : "backup_operation_details" ,
268+ CONST_RETENTION_OPERATION_DETAILS : "retention_operation_details"
243269 }
244270
245271 def __init__ (self , spec : Dict = None , ** kwargs ) -> None :
@@ -685,6 +711,114 @@ def with_model_file_description(
685711
686712 return self .set_spec (self .CONST_MODEL_FILE_DESCRIPTION , json_data )
687713
714+ @property
715+ def retention_setting (self ) -> ModelRetentionSetting :
716+ """
717+ Gets the retention_setting of this model.
718+
719+ :return: The retention_setting of this model.
720+ :rtype: RetentionSetting
721+ """
722+ return self .get_spec (self .CONST_RETENTION_SETTING )
723+
724+ def with_retention_setting (self , retention_setting : Union [Dict , ModelRetentionSetting ]) -> "DataScienceModel" :
725+ """
726+ Sets the retention setting details for the model.
727+
728+ Parameters
729+ ----------
730+ retention_setting : Union[Dict, RetentionSetting]
731+ The retention setting details for the model. Can be provided as either a dictionary or
732+ an instance of the `RetentionSetting` class.
733+
734+ Returns
735+ -------
736+ DataScienceModel
737+ The `DataScienceModel` instance (self) for method chaining.
738+ """
739+ if retention_setting and isinstance (retention_setting , dict ):
740+ try :
741+ retention_setting = ModelRetentionSetting .from_dict (retention_setting )
742+ except Exception as err :
743+ logger .warn (f"Failed to convert retention_setting from dict: { err } " )
744+
745+ return self .set_spec (self .CONST_RETENTION_SETTING , retention_setting )
746+
747+
748+
749+ @property
750+ def backup_setting (self ) -> ModelBackupSetting :
751+ """
752+ Gets the backup_setting of this model.
753+
754+ :return: The backup_setting of this model.
755+ :rtype: BackupSetting
756+ """
757+ return self .get_spec (self .CONST_BACKUP_SETTING )
758+
759+ def with_backup_setting (self , backup_setting : Union [Dict , ModelBackupSetting ]) -> "DataScienceModel" :
760+ """
761+ Sets the model's backup setting details.
762+
763+ Parameters
764+ ----------
765+ backup_setting : Union[Dict, BackupSetting]
766+ The backup setting details for the model. This can be passed as either a dictionary or
767+ an instance of the `BackupSetting` class.
768+
769+ Returns
770+ -------
771+ DataScienceModel
772+ The `DataScienceModel` instance (self) for method chaining.
773+ """
774+ if backup_setting and isinstance (backup_setting , dict ):
775+ try :
776+ backup_setting = ModelBackupSetting .from_dict (backup_setting )
777+ except Exception as err :
778+ logger .warn (f"Failed to convert backup_setting from dict: { err } " )
779+
780+ return self .set_spec (self .CONST_BACKUP_SETTING , backup_setting )
781+
782+ @property
783+ def retention_operation_details (self ) -> ModelRetentionOperationDetails :
784+ """
785+ Gets the retention_operation_details of this Model using the spec constant.
786+
787+ :return: The retention_operation_details of this Model.
788+ :rtype: ModelRetentionOperationDetails
789+ """
790+ return self .get_spec (self .CONST_RETENTION_OPERATION_DETAILS )
791+
792+ @retention_operation_details .setter
793+ def retention_operation_details (self , retention_operation_details : ModelRetentionOperationDetails ) -> "DataScienceModel" :
794+ """
795+ Sets the retention_operation_details of this Model using the spec constant.
796+
797+ :param retention_operation_details: The retention_operation_details of this Model.
798+ :type: ModelRetentionOperationDetails
799+ """
800+ return self .set_spec (self .CONST_RETENTION_OPERATION_DETAILS , retention_operation_details )
801+
802+ @property
803+ def backup_operation_details (self ) -> "ModelBackupOperationDetails" :
804+ """
805+ Gets the backup_operation_details of this Model using the spec constant.
806+
807+ :return: The backup_operation_details of this Model.
808+ :rtype: ModelBackupOperationDetails
809+ """
810+ return self .get_spec (self .CONST_BACKUP_OPERATION_DETAILS )
811+
812+ @backup_operation_details .setter
813+ def backup_operation_details (self , backup_operation_details : "ModelBackupOperationDetails" ) -> "DataScienceModel" :
814+ """
815+ Sets the backup_operation_details of this Model using the spec constant.
816+
817+ :param backup_operation_details: The backup_operation_details of this Model.
818+ :type: ModelBackupOperationDetails
819+ """
820+ return self .set_spec (self .CONST_BACKUP_OPERATION_DETAILS , backup_operation_details )
821+
688822 def create (self , ** kwargs ) -> "DataScienceModel" :
689823 """Creates datascience model.
690824
@@ -900,6 +1034,8 @@ def upload_artifact(
9001034 artifact_uploader .upload ()
9011035
9021036 self ._remove_file_description_artifact ()
1037+
1038+
9031039
9041040 def _remove_file_description_artifact (self ):
9051041 """Removes temporary model file description artifact for model by reference."""
@@ -1181,6 +1317,8 @@ def _to_oci_dsc_model(self, **kwargs):
11811317 self .CONST_CUSTOM_METADATA : "_to_oci_metadata" ,
11821318 self .CONST_DEFINED_METADATA : "_to_oci_metadata" ,
11831319 self .CONST_PROVENANCE_METADATA : "_to_oci_metadata" ,
1320+ self .CONST_BACKUP_SETTING : "to_json" ,
1321+ self .CONST_RETENTION_SETTING : "to_json"
11841322 }
11851323 dsc_spec = {}
11861324 for infra_attr , dsc_attr in self .attribute_map .items ():
@@ -1219,6 +1357,8 @@ def _update_from_oci_dsc_model(
12191357 self .CONST_OUTPUT_SCHEMA : [Schema .from_json , json .loads ],
12201358 self .CONST_CUSTOM_METADATA : ModelCustomMetadata ._from_oci_metadata ,
12211359 self .CONST_DEFINED_METADATA : ModelTaxonomyMetadata ._from_oci_metadata ,
1360+ self .CONST_BACKUP_SETTING : ModelBackupSetting .from_json ,
1361+ self .CONST_RETENTION_SETTING : ModelRetentionSetting .from_json ,
12221362 }
12231363
12241364 # Update the main properties
0 commit comments