|
26 | 26 | ModelArtifactSizeError, |
27 | 27 | BucketNotVersionedError, |
28 | 28 | ModelFileDescriptionError, |
29 | | - InvalidArtifactType, ModelRetentionSetting, ModelBackupSetting, |
| 29 | + InvalidArtifactType, |
| 30 | + ModelRetentionSetting, |
| 31 | + ModelBackupSetting, |
30 | 32 | ) |
31 | 33 | from ads.model.model_metadata import ( |
32 | 34 | ModelCustomMetadata, |
|
44 | 46 | from ads.config import AQUA_SERVICE_MODELS_BUCKET as SERVICE_MODELS_BUCKET |
45 | 47 |
|
46 | 48 | MODEL_OCID = "ocid1.datasciencemodel.oc1.iad.<unique_ocid>" |
47 | | - |
| 49 | + |
48 | 50 | OCI_MODEL_PAYLOAD = { |
49 | 51 | "id": MODEL_OCID, |
50 | 52 | "compartment_id": "ocid1.compartment.oc1..<unique_ocid>", |
|
71 | 73 | {"key": "UseCaseType", "value": "multinomial_classification"}, |
72 | 74 | {"key": "Hyperparameters"}, |
73 | 75 | {"key": "ArtifactTestResults"}, |
| 76 | + {"key": "UnexpectedKey", "value": "unexpected_value"}, |
74 | 77 | ], |
75 | 78 | "backup_setting": { |
76 | 79 | "is_backup_enabled": True, |
77 | 80 | "backup_region": "us-phoenix-1", |
78 | | - "customer_notification_type": "ALL" |
| 81 | + "customer_notification_type": "ALL", |
79 | 82 | }, |
80 | 83 | "retention_setting": { |
81 | 84 | "archive_after_days": 30, |
82 | 85 | "delete_after_days": 90, |
83 | | - "customer_notification_type": "ALL" |
| 86 | + "customer_notification_type": "ALL", |
84 | 87 | }, |
85 | 88 | "input_schema": '{"schema": [{"dtype": "int64", "feature_type": "Integer", "name": 0, "domain": {"values": "", "stats": {}, "constraints": []}, "required": true, "description": "0", "order": 0}], "version": "1.1"}', |
86 | 89 | "output_schema": '{"schema": [{"dtype": "int64", "feature_type": "Integer", "name": 0, "domain": {"values": "", "stats": {}, "constraints": []}, "required": true, "description": "0", "order": 0}], "version": "1.1"}', |
|
148 | 151 | {"key": "UseCaseType", "value": "multinomial_classification"}, |
149 | 152 | {"key": "Hyperparameters", "value": None}, |
150 | 153 | {"key": "ArtifactTestResults", "value": None}, |
| 154 | + {"key": "UnexpectedKey", "value": "unexpected_value"}, |
151 | 155 | ] |
152 | 156 | }, |
153 | 157 | "provenanceMetadata": { |
|
161 | 165 | "backupSetting": { |
162 | 166 | "is_backup_enabled": True, |
163 | 167 | "backup_region": "us-phoenix-1", |
164 | | - "customer_notification_type": "ALL" |
| 168 | + "customer_notification_type": "ALL", |
165 | 169 | }, |
166 | 170 | "retentionSetting": { |
167 | 171 | "archive_after_days": 30, |
168 | 172 | "delete_after_days": 90, |
169 | | - "customer_notification_type": "ALL" |
| 173 | + "customer_notification_type": "ALL", |
170 | 174 | }, |
171 | 175 | "artifact": "ocid1.datasciencemodel.oc1.iad.<unique_ocid>.zip", |
172 | 176 | } |
@@ -327,8 +331,8 @@ def test_with_methods_1(self, mock_load_default_properties): |
327 | 331 | .with_defined_metadata_list(self.payload["definedMetadataList"]) |
328 | 332 | .with_provenance_metadata(self.payload["provenanceMetadata"]) |
329 | 333 | .with_artifact(self.payload["artifact"]) |
330 | | - .with_backup_setting(self.payload['backupSetting']) |
331 | | - .with_retention_setting(self.payload['retentionSetting']) |
| 334 | + .with_backup_setting(self.payload["backupSetting"]) |
| 335 | + .with_retention_setting(self.payload["retentionSetting"]) |
332 | 336 | ) |
333 | 337 | assert self.prepare_dict(dsc_model.to_dict()["spec"]) == self.prepare_dict( |
334 | 338 | self.payload |
@@ -356,8 +360,12 @@ def test_with_methods_2(self): |
356 | 360 | ModelProvenanceMetadata.from_dict(self.payload["provenanceMetadata"]) |
357 | 361 | ) |
358 | 362 | .with_artifact(self.payload["artifact"]) |
359 | | - .with_backup_setting(ModelBackupSetting.from_dict(self.payload['backupSetting'])) |
360 | | - .with_retention_setting(ModelRetentionSetting.from_dict(self.payload['retentionSetting'])) |
| 363 | + .with_backup_setting( |
| 364 | + ModelBackupSetting.from_dict(self.payload["backupSetting"]) |
| 365 | + ) |
| 366 | + .with_retention_setting( |
| 367 | + ModelRetentionSetting.from_dict(self.payload["retentionSetting"]) |
| 368 | + ) |
361 | 369 | ) |
362 | 370 | assert self.prepare_dict(dsc_model.to_dict()["spec"]) == self.prepare_dict( |
363 | 371 | self.payload |
@@ -605,7 +613,7 @@ def test__to_oci_dsc_model(self): |
605 | 613 | True, |
606 | 614 | ], |
607 | 615 | ) |
608 | | - @patch.object(OCIDataScienceModel, "is_model_by_reference") |
| 616 | + @patch.object(OCIDataScienceModel, "_is_model_by_reference") |
609 | 617 | @patch.object(OCIDataScienceModel, "get_artifact_info") |
610 | 618 | @patch.object(OCIDataScienceModel, "get_model_provenance") |
611 | 619 | @patch.object(DataScienceModel, "_download_file_description_artifact") |
|
0 commit comments