@@ -477,6 +477,7 @@ def deploy(
477477 max_replica_count : int = 1 ,
478478 accelerator_type : Optional [str ] = None ,
479479 accelerator_count : Optional [int ] = None ,
480+ service_account : Optional [str ] = None ,
480481 explanation_metadata : Optional [explain .ExplanationMetadata ] = None ,
481482 explanation_parameters : Optional [explain .ExplanationParameters ] = None ,
482483 metadata : Optional [Sequence [Tuple [str , str ]]] = (),
@@ -531,6 +532,13 @@ def deploy(
531532 NVIDIA_TESLA_V100, NVIDIA_TESLA_P4, NVIDIA_TESLA_T4, TPU_V2, TPU_V3
532533 accelerator_count (int):
533534 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.
534542 explanation_metadata (explain.ExplanationMetadata):
535543 Optional. Metadata describing the Model's input and output for explanation.
536544 Both `explanation_metadata` and `explanation_parameters` must be
@@ -569,6 +577,7 @@ def deploy(
569577 max_replica_count = max_replica_count ,
570578 accelerator_type = accelerator_type ,
571579 accelerator_count = accelerator_count ,
580+ service_account = service_account ,
572581 explanation_metadata = explanation_metadata ,
573582 explanation_parameters = explanation_parameters ,
574583 metadata = metadata ,
@@ -587,6 +596,7 @@ def _deploy(
587596 max_replica_count : Optional [int ] = 1 ,
588597 accelerator_type : Optional [str ] = None ,
589598 accelerator_count : Optional [int ] = None ,
599+ service_account : Optional [str ] = None ,
590600 explanation_metadata : Optional [explain .ExplanationMetadata ] = None ,
591601 explanation_parameters : Optional [explain .ExplanationParameters ] = None ,
592602 metadata : Optional [Sequence [Tuple [str , str ]]] = (),
@@ -641,6 +651,13 @@ def _deploy(
641651 NVIDIA_TESLA_V100, NVIDIA_TESLA_P4, NVIDIA_TESLA_T4, TPU_V2, TPU_V3
642652 accelerator_count (int):
643653 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.
644661 explanation_metadata (explain.ExplanationMetadata):
645662 Optional. Metadata describing the Model's input and output for explanation.
646663 Both `explanation_metadata` and `explanation_parameters` must be
@@ -677,6 +694,7 @@ def _deploy(
677694 max_replica_count = max_replica_count ,
678695 accelerator_type = accelerator_type ,
679696 accelerator_count = accelerator_count ,
697+ service_account = service_account ,
680698 explanation_metadata = explanation_metadata ,
681699 explanation_parameters = explanation_parameters ,
682700 metadata = metadata ,
@@ -701,6 +719,7 @@ def _deploy_call(
701719 max_replica_count : Optional [int ] = 1 ,
702720 accelerator_type : Optional [str ] = None ,
703721 accelerator_count : Optional [int ] = None ,
722+ service_account : Optional [str ] = None ,
704723 explanation_metadata : Optional [explain .ExplanationMetadata ] = None ,
705724 explanation_parameters : Optional [explain .ExplanationParameters ] = None ,
706725 metadata : Optional [Sequence [Tuple [str , str ]]] = (),
@@ -753,6 +772,13 @@ def _deploy_call(
753772 is not provided, the larger value of min_replica_count or 1 will
754773 be used. If value provided is smaller than min_replica_count, it
755774 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.
756782 explanation_metadata (explain.ExplanationMetadata):
757783 Optional. Metadata describing the Model's input and output for explanation.
758784 Both `explanation_metadata` and `explanation_parameters` must be
@@ -788,6 +814,12 @@ def _deploy_call(
788814 gca_endpoint = gca_endpoint_v1beta1
789815 gca_machine_resources = gca_machine_resources_v1beta1
790816
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+
791823 if machine_type :
792824 machine_spec = gca_machine_resources .MachineSpec (machine_type = machine_type )
793825
@@ -796,26 +828,17 @@ def _deploy_call(
796828 machine_spec .accelerator_type = accelerator_type
797829 machine_spec .accelerator_count = accelerator_count
798830
799- dedicated_resources = gca_machine_resources .DedicatedResources (
831+ deployed_model . dedicated_resources = gca_machine_resources .DedicatedResources (
800832 machine_spec = machine_spec ,
801833 min_replica_count = min_replica_count ,
802834 max_replica_count = max_replica_count ,
803835 )
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+
809837 else :
810- automatic_resources = gca_machine_resources .AutomaticResources (
838+ deployed_model . automatic_resources = gca_machine_resources .AutomaticResources (
811839 min_replica_count = min_replica_count ,
812840 max_replica_count = max_replica_count ,
813841 )
814- deployed_model = gca_endpoint .DeployedModel (
815- automatic_resources = automatic_resources ,
816- model = model_resource_name ,
817- display_name = deployed_model_display_name ,
818- )
819842
820843 # Service will throw error if both metadata and parameters are not provided
821844 if explanation_metadata and explanation_parameters :
@@ -1493,6 +1516,7 @@ def deploy(
14931516 max_replica_count : Optional [int ] = 1 ,
14941517 accelerator_type : Optional [str ] = None ,
14951518 accelerator_count : Optional [int ] = None ,
1519+ service_account : Optional [str ] = None ,
14961520 explanation_metadata : Optional [explain .ExplanationMetadata ] = None ,
14971521 explanation_parameters : Optional [explain .ExplanationParameters ] = None ,
14981522 metadata : Optional [Sequence [Tuple [str , str ]]] = (),
@@ -1548,6 +1572,13 @@ def deploy(
15481572 NVIDIA_TESLA_V100, NVIDIA_TESLA_P4, NVIDIA_TESLA_T4, TPU_V2, TPU_V3
15491573 accelerator_count (int):
15501574 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.
15511582 explanation_metadata (explain.ExplanationMetadata):
15521583 Optional. Metadata describing the Model's input and output for explanation.
15531584 Both `explanation_metadata` and `explanation_parameters` must be
@@ -1601,6 +1632,7 @@ def deploy(
16011632 max_replica_count = max_replica_count ,
16021633 accelerator_type = accelerator_type ,
16031634 accelerator_count = accelerator_count ,
1635+ service_account = service_account ,
16041636 explanation_metadata = explanation_metadata ,
16051637 explanation_parameters = explanation_parameters ,
16061638 metadata = metadata ,
@@ -1621,6 +1653,7 @@ def _deploy(
16211653 max_replica_count : Optional [int ] = 1 ,
16221654 accelerator_type : Optional [str ] = None ,
16231655 accelerator_count : Optional [int ] = None ,
1656+ service_account : Optional [str ] = None ,
16241657 explanation_metadata : Optional [explain .ExplanationMetadata ] = None ,
16251658 explanation_parameters : Optional [explain .ExplanationParameters ] = None ,
16261659 metadata : Optional [Sequence [Tuple [str , str ]]] = (),
@@ -1676,6 +1709,13 @@ def _deploy(
16761709 NVIDIA_TESLA_V100, NVIDIA_TESLA_P4, NVIDIA_TESLA_T4, TPU_V2, TPU_V3
16771710 accelerator_count (int):
16781711 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.
16791719 explanation_metadata (explain.ExplanationMetadata):
16801720 Optional. Metadata describing the Model's input and output for explanation.
16811721 Both `explanation_metadata` and `explanation_parameters` must be
@@ -1732,6 +1772,7 @@ def _deploy(
17321772 max_replica_count = max_replica_count ,
17331773 accelerator_type = accelerator_type ,
17341774 accelerator_count = accelerator_count ,
1775+ service_account = service_account ,
17351776 explanation_metadata = explanation_metadata ,
17361777 explanation_parameters = explanation_parameters ,
17371778 metadata = metadata ,
0 commit comments