@@ -477,6 +477,7 @@ def deploy(
477
477
max_replica_count : int = 1 ,
478
478
accelerator_type : Optional [str ] = None ,
479
479
accelerator_count : Optional [int ] = None ,
480
+ service_account : Optional [str ] = None ,
480
481
explanation_metadata : Optional [explain .ExplanationMetadata ] = None ,
481
482
explanation_parameters : Optional [explain .ExplanationParameters ] = None ,
482
483
metadata : Optional [Sequence [Tuple [str , str ]]] = (),
@@ -531,6 +532,13 @@ def deploy(
531
532
NVIDIA_TESLA_V100, NVIDIA_TESLA_P4, NVIDIA_TESLA_T4, TPU_V2, TPU_V3
532
533
accelerator_count (int):
533
534
Optional. The number of accelerators to attach to a worker replica.
535
+ service_account (str):
536
+ The service account that the DeployedModel's container runs as. Specify the
537
+ email address of the service account. If this service account is not
538
+ specified, the container runs as a service account that doesn't have access
539
+ to the resource project.
540
+ Users deploying the Model must have the `iam.serviceAccounts.actAs`
541
+ permission on this service account.
534
542
explanation_metadata (explain.ExplanationMetadata):
535
543
Optional. Metadata describing the Model's input and output for explanation.
536
544
Both `explanation_metadata` and `explanation_parameters` must be
@@ -569,6 +577,7 @@ def deploy(
569
577
max_replica_count = max_replica_count ,
570
578
accelerator_type = accelerator_type ,
571
579
accelerator_count = accelerator_count ,
580
+ service_account = service_account ,
572
581
explanation_metadata = explanation_metadata ,
573
582
explanation_parameters = explanation_parameters ,
574
583
metadata = metadata ,
@@ -587,6 +596,7 @@ def _deploy(
587
596
max_replica_count : Optional [int ] = 1 ,
588
597
accelerator_type : Optional [str ] = None ,
589
598
accelerator_count : Optional [int ] = None ,
599
+ service_account : Optional [str ] = None ,
590
600
explanation_metadata : Optional [explain .ExplanationMetadata ] = None ,
591
601
explanation_parameters : Optional [explain .ExplanationParameters ] = None ,
592
602
metadata : Optional [Sequence [Tuple [str , str ]]] = (),
@@ -641,6 +651,13 @@ def _deploy(
641
651
NVIDIA_TESLA_V100, NVIDIA_TESLA_P4, NVIDIA_TESLA_T4, TPU_V2, TPU_V3
642
652
accelerator_count (int):
643
653
Optional. The number of accelerators to attach to a worker replica.
654
+ service_account (str):
655
+ The service account that the DeployedModel's container runs as. Specify the
656
+ email address of the service account. If this service account is not
657
+ specified, the container runs as a service account that doesn't have access
658
+ to the resource project.
659
+ Users deploying the Model must have the `iam.serviceAccounts.actAs`
660
+ permission on this service account.
644
661
explanation_metadata (explain.ExplanationMetadata):
645
662
Optional. Metadata describing the Model's input and output for explanation.
646
663
Both `explanation_metadata` and `explanation_parameters` must be
@@ -677,6 +694,7 @@ def _deploy(
677
694
max_replica_count = max_replica_count ,
678
695
accelerator_type = accelerator_type ,
679
696
accelerator_count = accelerator_count ,
697
+ service_account = service_account ,
680
698
explanation_metadata = explanation_metadata ,
681
699
explanation_parameters = explanation_parameters ,
682
700
metadata = metadata ,
@@ -701,6 +719,7 @@ def _deploy_call(
701
719
max_replica_count : Optional [int ] = 1 ,
702
720
accelerator_type : Optional [str ] = None ,
703
721
accelerator_count : Optional [int ] = None ,
722
+ service_account : Optional [str ] = None ,
704
723
explanation_metadata : Optional [explain .ExplanationMetadata ] = None ,
705
724
explanation_parameters : Optional [explain .ExplanationParameters ] = None ,
706
725
metadata : Optional [Sequence [Tuple [str , str ]]] = (),
@@ -753,6 +772,13 @@ def _deploy_call(
753
772
is not provided, the larger value of min_replica_count or 1 will
754
773
be used. If value provided is smaller than min_replica_count, it
755
774
will automatically be increased to be min_replica_count.
775
+ service_account (str):
776
+ The service account that the DeployedModel's container runs as. Specify the
777
+ email address of the service account. If this service account is not
778
+ specified, the container runs as a service account that doesn't have access
779
+ to the resource project.
780
+ Users deploying the Model must have the `iam.serviceAccounts.actAs`
781
+ permission on this service account.
756
782
explanation_metadata (explain.ExplanationMetadata):
757
783
Optional. Metadata describing the Model's input and output for explanation.
758
784
Both `explanation_metadata` and `explanation_parameters` must be
@@ -788,6 +814,12 @@ def _deploy_call(
788
814
gca_endpoint = gca_endpoint_v1beta1
789
815
gca_machine_resources = gca_machine_resources_v1beta1
790
816
817
+ deployed_model = gca_endpoint .DeployedModel (
818
+ model = model_resource_name ,
819
+ display_name = deployed_model_display_name ,
820
+ service_account = service_account ,
821
+ )
822
+
791
823
if machine_type :
792
824
machine_spec = gca_machine_resources .MachineSpec (machine_type = machine_type )
793
825
@@ -796,26 +828,17 @@ def _deploy_call(
796
828
machine_spec .accelerator_type = accelerator_type
797
829
machine_spec .accelerator_count = accelerator_count
798
830
799
- dedicated_resources = gca_machine_resources .DedicatedResources (
831
+ deployed_model . dedicated_resources = gca_machine_resources .DedicatedResources (
800
832
machine_spec = machine_spec ,
801
833
min_replica_count = min_replica_count ,
802
834
max_replica_count = max_replica_count ,
803
835
)
804
- deployed_model = gca_endpoint .DeployedModel (
805
- dedicated_resources = dedicated_resources ,
806
- model = model_resource_name ,
807
- display_name = deployed_model_display_name ,
808
- )
836
+
809
837
else :
810
- automatic_resources = gca_machine_resources .AutomaticResources (
838
+ deployed_model . automatic_resources = gca_machine_resources .AutomaticResources (
811
839
min_replica_count = min_replica_count ,
812
840
max_replica_count = max_replica_count ,
813
841
)
814
- deployed_model = gca_endpoint .DeployedModel (
815
- automatic_resources = automatic_resources ,
816
- model = model_resource_name ,
817
- display_name = deployed_model_display_name ,
818
- )
819
842
820
843
# Service will throw error if both metadata and parameters are not provided
821
844
if explanation_metadata and explanation_parameters :
@@ -1493,6 +1516,7 @@ def deploy(
1493
1516
max_replica_count : Optional [int ] = 1 ,
1494
1517
accelerator_type : Optional [str ] = None ,
1495
1518
accelerator_count : Optional [int ] = None ,
1519
+ service_account : Optional [str ] = None ,
1496
1520
explanation_metadata : Optional [explain .ExplanationMetadata ] = None ,
1497
1521
explanation_parameters : Optional [explain .ExplanationParameters ] = None ,
1498
1522
metadata : Optional [Sequence [Tuple [str , str ]]] = (),
@@ -1548,6 +1572,13 @@ def deploy(
1548
1572
NVIDIA_TESLA_V100, NVIDIA_TESLA_P4, NVIDIA_TESLA_T4, TPU_V2, TPU_V3
1549
1573
accelerator_count (int):
1550
1574
Optional. The number of accelerators to attach to a worker replica.
1575
+ service_account (str):
1576
+ The service account that the DeployedModel's container runs as. Specify the
1577
+ email address of the service account. If this service account is not
1578
+ specified, the container runs as a service account that doesn't have access
1579
+ to the resource project.
1580
+ Users deploying the Model must have the `iam.serviceAccounts.actAs`
1581
+ permission on this service account.
1551
1582
explanation_metadata (explain.ExplanationMetadata):
1552
1583
Optional. Metadata describing the Model's input and output for explanation.
1553
1584
Both `explanation_metadata` and `explanation_parameters` must be
@@ -1601,6 +1632,7 @@ def deploy(
1601
1632
max_replica_count = max_replica_count ,
1602
1633
accelerator_type = accelerator_type ,
1603
1634
accelerator_count = accelerator_count ,
1635
+ service_account = service_account ,
1604
1636
explanation_metadata = explanation_metadata ,
1605
1637
explanation_parameters = explanation_parameters ,
1606
1638
metadata = metadata ,
@@ -1621,6 +1653,7 @@ def _deploy(
1621
1653
max_replica_count : Optional [int ] = 1 ,
1622
1654
accelerator_type : Optional [str ] = None ,
1623
1655
accelerator_count : Optional [int ] = None ,
1656
+ service_account : Optional [str ] = None ,
1624
1657
explanation_metadata : Optional [explain .ExplanationMetadata ] = None ,
1625
1658
explanation_parameters : Optional [explain .ExplanationParameters ] = None ,
1626
1659
metadata : Optional [Sequence [Tuple [str , str ]]] = (),
@@ -1676,6 +1709,13 @@ def _deploy(
1676
1709
NVIDIA_TESLA_V100, NVIDIA_TESLA_P4, NVIDIA_TESLA_T4, TPU_V2, TPU_V3
1677
1710
accelerator_count (int):
1678
1711
Optional. The number of accelerators to attach to a worker replica.
1712
+ service_account (str):
1713
+ The service account that the DeployedModel's container runs as. Specify the
1714
+ email address of the service account. If this service account is not
1715
+ specified, the container runs as a service account that doesn't have access
1716
+ to the resource project.
1717
+ Users deploying the Model must have the `iam.serviceAccounts.actAs`
1718
+ permission on this service account.
1679
1719
explanation_metadata (explain.ExplanationMetadata):
1680
1720
Optional. Metadata describing the Model's input and output for explanation.
1681
1721
Both `explanation_metadata` and `explanation_parameters` must be
@@ -1732,6 +1772,7 @@ def _deploy(
1732
1772
max_replica_count = max_replica_count ,
1733
1773
accelerator_type = accelerator_type ,
1734
1774
accelerator_count = accelerator_count ,
1775
+ service_account = service_account ,
1735
1776
explanation_metadata = explanation_metadata ,
1736
1777
explanation_parameters = explanation_parameters ,
1737
1778
metadata = metadata ,
0 commit comments