27
27
from google .cloud .aiplatform .metadata .types import base
28
28
from google .cloud .aiplatform .metadata .types import google_types
29
29
from google .cloud .aiplatform .metadata .types import system_types
30
- from google .cloud .aiplatform .metadata .types import utils
31
30
31
+ from google .cloud .aiplatform .compat .types import model_v1 as model
32
32
from google .cloud .aiplatform_v1 import MetadataServiceClient
33
33
from google .cloud .aiplatform_v1 import Artifact as GapicArtifact
34
34
@@ -212,13 +212,13 @@ def test_vertex_endpoint_constructor_parameters_are_set_correctly(self):
212
212
assert artifact .schema_version == _TEST_SCHEMA_VERSION
213
213
214
214
def test_unmanaged_container_model_title_is_set_correctly (self ):
215
- predict_schema_ta = utils .PredictSchemata (
215
+ predict_schema_ta = model .PredictSchemata (
216
216
instance_schema_uri = "instance_uri" ,
217
217
prediction_schema_uri = "prediction_uri" ,
218
218
parameters_schema_uri = "parameters_uri" ,
219
219
)
220
220
221
- container_spec = utils . ContainerSpec (
221
+ container_spec = model . ModelContainerSpec (
222
222
image_uri = "gcr.io/test_container_image_uri"
223
223
)
224
224
artifact = google_types .UnmanagedContainerModel (
@@ -228,13 +228,13 @@ def test_unmanaged_container_model_title_is_set_correctly(self):
228
228
assert artifact .schema_title == "google.UnmanagedContainerModel"
229
229
230
230
def test_unmanaged_container_model_resouce_name_is_set_in_metadata (self ):
231
- predict_schema_ta = utils .PredictSchemata (
231
+ predict_schema_ta = model .PredictSchemata (
232
232
instance_schema_uri = "instance_uri" ,
233
233
prediction_schema_uri = "prediction_uri" ,
234
234
parameters_schema_uri = "parameters_uri" ,
235
235
)
236
236
237
- container_spec = utils . ContainerSpec (
237
+ container_spec = model . ModelContainerSpec (
238
238
image_uri = "gcr.io/test_container_image_uri"
239
239
)
240
240
artifact = google_types .UnmanagedContainerModel (
@@ -245,13 +245,13 @@ def test_unmanaged_container_model_resouce_name_is_set_in_metadata(self):
245
245
assert artifact .metadata ["resourceName" ] == _TEST_ARTIFACT_NAME
246
246
247
247
def test_unmanaged_container_model_constructor_parameters_are_set_correctly (self ):
248
- predict_schema_ta = utils .PredictSchemata (
248
+ predict_schema_ta = model .PredictSchemata (
249
249
instance_schema_uri = "instance_uri" ,
250
250
prediction_schema_uri = "prediction_uri" ,
251
251
parameters_schema_uri = "parameters_uri" ,
252
252
)
253
253
254
- container_spec = utils . ContainerSpec (
254
+ container_spec = model . ModelContainerSpec (
255
255
image_uri = "gcr.io/test_container_image_uri"
256
256
)
257
257
@@ -360,73 +360,3 @@ def test_system_metrics_constructor_parameters_are_set_correctly(self):
360
360
assert artifact .metadata ["f1score" ] == 0.4
361
361
assert artifact .metadata ["mean_absolute_error" ] == 0.5
362
362
assert artifact .metadata ["mean_squared_error" ] == 0.6
363
-
364
-
365
- class TestMetadataUtils :
366
- def setup_method (self ):
367
- reload (initializer )
368
- reload (metadata )
369
- reload (aiplatform )
370
-
371
- def teardown_method (self ):
372
- initializer .global_pool .shutdown (wait = True )
373
-
374
- def test_predict_schemata_to_dict_method_returns_correct_schema (self ):
375
- predict_schema_ta = utils .PredictSchemata (
376
- instance_schema_uri = "instance_uri" ,
377
- prediction_schema_uri = "prediction_uri" ,
378
- parameters_schema_uri = "parameters_uri" ,
379
- )
380
- expected_results = {
381
- "instanceSchemaUri" : "instance_uri" ,
382
- "parametersSchemaUri" : "parameters_uri" ,
383
- "predictionSchemaUri" : "prediction_uri" ,
384
- }
385
-
386
- assert json .dumps (predict_schema_ta .to_dict ()) == json .dumps (expected_results )
387
-
388
- def test_container_spec_to_dict_method_returns_correct_schema (self ):
389
- container_spec = utils .ContainerSpec (
390
- image_uri = "gcr.io/some_container_image_uri" ,
391
- command = ["test_command" ],
392
- args = ["test_args" ],
393
- env = [{"env_var_name" : "env_var_value" }],
394
- ports = [1 ],
395
- predict_route = "test_prediction_rout" ,
396
- health_route = "test_health_rout" ,
397
- )
398
-
399
- expected_results = {
400
- "imageUri" : "gcr.io/some_container_image_uri" ,
401
- "command" : ["test_command" ],
402
- "args" : ["test_args" ],
403
- "env" : [{"env_var_name" : "env_var_value" }],
404
- "ports" : [1 ],
405
- "predictRoute" : "test_prediction_rout" ,
406
- "healthRoute" : "test_health_rout" ,
407
- }
408
-
409
- assert json .dumps (container_spec .to_dict ()) == json .dumps (expected_results )
410
-
411
- def test_container_spec_to_dict_method_returns_correct_schema (self ):
412
- container_spec = utils .ContainerSpec (
413
- image_uri = "gcr.io/some_container_image_uri" ,
414
- command = ["test_command" ],
415
- args = ["test_args" ],
416
- env = [{"env_var_name" : "env_var_value" }],
417
- ports = [1 ],
418
- predict_route = "test_prediction_rout" ,
419
- health_route = "test_health_rout" ,
420
- )
421
-
422
- expected_results = {
423
- "imageUri" : "gcr.io/some_container_image_uri" ,
424
- "command" : ["test_command" ],
425
- "args" : ["test_args" ],
426
- "env" : [{"env_var_name" : "env_var_value" }],
427
- "ports" : [1 ],
428
- "predictRoute" : "test_prediction_rout" ,
429
- "healthRoute" : "test_health_rout" ,
430
- }
431
-
432
- assert json .dumps (container_spec .to_dict ()) == json .dumps (expected_results )
0 commit comments