@@ -611,6 +611,9 @@ def test_create_with_labels(self, create_endpoint_mock, sync):
611
611
def test_deploy (self , deploy_model_mock , sync ):
612
612
test_endpoint = models .Endpoint (_TEST_ENDPOINT_NAME )
613
613
test_model = models .Model (_TEST_ID )
614
+ test_model ._gca_resource .supported_deployment_resources_types .append (
615
+ aiplatform .gapic .Model .DeploymentResourcesType .AUTOMATIC_RESOURCES
616
+ )
614
617
test_endpoint .deploy (test_model , sync = sync )
615
618
616
619
if not sync :
@@ -636,6 +639,9 @@ def test_deploy(self, deploy_model_mock, sync):
636
639
def test_deploy_with_display_name (self , deploy_model_mock , sync ):
637
640
test_endpoint = models .Endpoint (_TEST_ENDPOINT_NAME )
638
641
test_model = models .Model (_TEST_ID )
642
+ test_model ._gca_resource .supported_deployment_resources_types .append (
643
+ aiplatform .gapic .Model .DeploymentResourcesType .AUTOMATIC_RESOURCES
644
+ )
639
645
test_endpoint .deploy (
640
646
model = test_model , deployed_model_display_name = _TEST_DISPLAY_NAME , sync = sync
641
647
)
@@ -664,6 +670,9 @@ def test_deploy_raise_error_traffic_80(self, sync):
664
670
with pytest .raises (ValueError ):
665
671
test_endpoint = models .Endpoint (_TEST_ENDPOINT_NAME )
666
672
test_model = models .Model (_TEST_ID )
673
+ test_model ._gca_resource .supported_deployment_resources_types .append (
674
+ aiplatform .gapic .Model .DeploymentResourcesType .AUTOMATIC_RESOURCES
675
+ )
667
676
test_endpoint .deploy (model = test_model , traffic_percentage = 80 , sync = sync )
668
677
669
678
if not sync :
@@ -675,6 +684,9 @@ def test_deploy_raise_error_traffic_120(self, sync):
675
684
with pytest .raises (ValueError ):
676
685
test_endpoint = models .Endpoint (_TEST_ENDPOINT_NAME )
677
686
test_model = models .Model (_TEST_ID )
687
+ test_model ._gca_resource .supported_deployment_resources_types .append (
688
+ aiplatform .gapic .Model .DeploymentResourcesType .AUTOMATIC_RESOURCES
689
+ )
678
690
test_endpoint .deploy (model = test_model , traffic_percentage = 120 , sync = sync )
679
691
680
692
@pytest .mark .usefixtures ("get_endpoint_mock" , "get_model_mock" )
@@ -683,6 +695,9 @@ def test_deploy_raise_error_traffic_negative(self, sync):
683
695
with pytest .raises (ValueError ):
684
696
test_endpoint = models .Endpoint (_TEST_ENDPOINT_NAME )
685
697
test_model = models .Model (_TEST_ID )
698
+ test_model ._gca_resource .supported_deployment_resources_types .append (
699
+ aiplatform .gapic .Model .DeploymentResourcesType .AUTOMATIC_RESOURCES
700
+ )
686
701
test_endpoint .deploy (model = test_model , traffic_percentage = - 18 , sync = sync )
687
702
688
703
@pytest .mark .usefixtures ("get_endpoint_mock" , "get_model_mock" )
@@ -691,6 +706,9 @@ def test_deploy_raise_error_min_replica(self, sync):
691
706
with pytest .raises (ValueError ):
692
707
test_endpoint = models .Endpoint (_TEST_ENDPOINT_NAME )
693
708
test_model = models .Model (_TEST_ID )
709
+ test_model ._gca_resource .supported_deployment_resources_types .append (
710
+ aiplatform .gapic .Model .DeploymentResourcesType .AUTOMATIC_RESOURCES
711
+ )
694
712
test_endpoint .deploy (model = test_model , min_replica_count = - 1 , sync = sync )
695
713
696
714
@pytest .mark .usefixtures ("get_endpoint_mock" , "get_model_mock" )
@@ -699,6 +717,9 @@ def test_deploy_raise_error_max_replica(self, sync):
699
717
with pytest .raises (ValueError ):
700
718
test_endpoint = models .Endpoint (_TEST_ENDPOINT_NAME )
701
719
test_model = models .Model (_TEST_ID )
720
+ test_model ._gca_resource .supported_deployment_resources_types .append (
721
+ aiplatform .gapic .Model .DeploymentResourcesType .AUTOMATIC_RESOURCES
722
+ )
702
723
test_endpoint .deploy (model = test_model , max_replica_count = - 2 , sync = sync )
703
724
704
725
@pytest .mark .usefixtures ("get_endpoint_mock" , "get_model_mock" )
@@ -707,6 +728,9 @@ def test_deploy_raise_error_traffic_split(self, sync):
707
728
with pytest .raises (ValueError ):
708
729
test_endpoint = models .Endpoint (_TEST_ENDPOINT_NAME )
709
730
test_model = models .Model (_TEST_ID )
731
+ test_model ._gca_resource .supported_deployment_resources_types .append (
732
+ aiplatform .gapic .Model .DeploymentResourcesType .AUTOMATIC_RESOURCES
733
+ )
710
734
test_endpoint .deploy (model = test_model , traffic_split = {"a" : 99 }, sync = sync )
711
735
712
736
@pytest .mark .usefixtures ("get_model_mock" )
@@ -723,6 +747,9 @@ def test_deploy_with_traffic_percent(self, deploy_model_mock, sync):
723
747
724
748
test_endpoint = models .Endpoint (_TEST_ENDPOINT_NAME )
725
749
test_model = models .Model (_TEST_ID )
750
+ test_model ._gca_resource .supported_deployment_resources_types .append (
751
+ aiplatform .gapic .Model .DeploymentResourcesType .AUTOMATIC_RESOURCES
752
+ )
726
753
test_endpoint .deploy (model = test_model , traffic_percentage = 70 , sync = sync )
727
754
if not sync :
728
755
test_endpoint .wait ()
@@ -755,6 +782,9 @@ def test_deploy_with_traffic_split(self, deploy_model_mock, sync):
755
782
756
783
test_endpoint = models .Endpoint (_TEST_ENDPOINT_NAME )
757
784
test_model = models .Model (_TEST_ID )
785
+ test_model ._gca_resource .supported_deployment_resources_types .append (
786
+ aiplatform .gapic .Model .DeploymentResourcesType .AUTOMATIC_RESOURCES
787
+ )
758
788
test_endpoint .deploy (
759
789
model = test_model , traffic_split = {"model1" : 30 , "0" : 70 }, sync = sync
760
790
)
@@ -781,6 +811,9 @@ def test_deploy_with_traffic_split(self, deploy_model_mock, sync):
781
811
def test_deploy_with_dedicated_resources (self , deploy_model_mock , sync ):
782
812
test_endpoint = models .Endpoint (_TEST_ENDPOINT_NAME )
783
813
test_model = models .Model (_TEST_ID )
814
+ test_model ._gca_resource .supported_deployment_resources_types .append (
815
+ aiplatform .gapic .Model .DeploymentResourcesType .DEDICATED_RESOURCES
816
+ )
784
817
test_endpoint .deploy (
785
818
model = test_model ,
786
819
machine_type = _TEST_MACHINE_TYPE ,
@@ -821,6 +854,9 @@ def test_deploy_with_dedicated_resources(self, deploy_model_mock, sync):
821
854
def test_deploy_with_explanations (self , deploy_model_with_explanations_mock , sync ):
822
855
test_endpoint = models .Endpoint (_TEST_ENDPOINT_NAME )
823
856
test_model = models .Model (_TEST_ID )
857
+ test_model ._gca_resource .supported_deployment_resources_types .append (
858
+ aiplatform .gapic .Model .DeploymentResourcesType .DEDICATED_RESOURCES
859
+ )
824
860
test_endpoint .deploy (
825
861
model = test_model ,
826
862
machine_type = _TEST_MACHINE_TYPE ,
@@ -865,6 +901,9 @@ def test_deploy_with_explanations(self, deploy_model_with_explanations_mock, syn
865
901
def test_deploy_with_min_replica_count (self , deploy_model_mock , sync ):
866
902
test_endpoint = models .Endpoint (_TEST_ENDPOINT_NAME )
867
903
test_model = models .Model (_TEST_ID )
904
+ test_model ._gca_resource .supported_deployment_resources_types .append (
905
+ aiplatform .gapic .Model .DeploymentResourcesType .AUTOMATIC_RESOURCES
906
+ )
868
907
test_endpoint .deploy (model = test_model , min_replica_count = 2 , sync = sync )
869
908
870
909
if not sync :
@@ -889,6 +928,9 @@ def test_deploy_with_min_replica_count(self, deploy_model_mock, sync):
889
928
def test_deploy_with_max_replica_count (self , deploy_model_mock , sync ):
890
929
test_endpoint = models .Endpoint (_TEST_ENDPOINT_NAME )
891
930
test_model = models .Model (_TEST_ID )
931
+ test_model ._gca_resource .supported_deployment_resources_types .append (
932
+ aiplatform .gapic .Model .DeploymentResourcesType .AUTOMATIC_RESOURCES
933
+ )
892
934
test_endpoint .deploy (model = test_model , max_replica_count = 2 , sync = sync )
893
935
if not sync :
894
936
test_endpoint .wait ()
0 commit comments