@@ -1291,6 +1291,7 @@ def deploy(
1291
1291
reservation_affinity_values : Optional [List [str ]] = None ,
1292
1292
spot : bool = False ,
1293
1293
fast_tryout_enabled : bool = False ,
1294
+ system_labels : Optional [Dict [str , str ]] = None ,
1294
1295
) -> None :
1295
1296
"""Deploys a Model to the Endpoint.
1296
1297
@@ -1403,6 +1404,9 @@ def deploy(
1403
1404
If True, model will be deployed using faster deployment path.
1404
1405
Useful for quick experiments. Not for production workloads. Only
1405
1406
available for most popular models with certain machine types.
1407
+ system_labels (Dict[str, str]):
1408
+ Optional. System labels to apply to Model Garden deployments.
1409
+ System labels are managed by Google for internal use only.
1406
1410
"""
1407
1411
self ._sync_gca_resource_if_skipped ()
1408
1412
@@ -1447,6 +1451,7 @@ def deploy(
1447
1451
disable_container_logging = disable_container_logging ,
1448
1452
deployment_resource_pool = deployment_resource_pool ,
1449
1453
fast_tryout_enabled = fast_tryout_enabled ,
1454
+ system_labels = system_labels ,
1450
1455
)
1451
1456
1452
1457
@base .optional_sync ()
@@ -1477,6 +1482,7 @@ def _deploy(
1477
1482
disable_container_logging : bool = False ,
1478
1483
deployment_resource_pool : Optional [DeploymentResourcePool ] = None ,
1479
1484
fast_tryout_enabled : bool = False ,
1485
+ system_labels : Optional [Dict [str , str ]] = None ,
1480
1486
) -> None :
1481
1487
"""Deploys a Model to the Endpoint.
1482
1488
@@ -1583,6 +1589,9 @@ def _deploy(
1583
1589
If True, model will be deployed using faster deployment path.
1584
1590
Useful for quick experiments. Not for production workloads. Only
1585
1591
available for most popular models with certain machine types.
1592
+ system_labels (Dict[str, str]):
1593
+ Optional. System labels to apply to Model Garden deployments.
1594
+ System labels are managed by Google for internal use only.
1586
1595
"""
1587
1596
_LOGGER .log_action_start_against_resource (
1588
1597
f"Deploying Model { model .resource_name } to" , "" , self
@@ -1617,6 +1626,7 @@ def _deploy(
1617
1626
disable_container_logging = disable_container_logging ,
1618
1627
deployment_resource_pool = deployment_resource_pool ,
1619
1628
fast_tryout_enabled = fast_tryout_enabled ,
1629
+ system_labels = system_labels ,
1620
1630
)
1621
1631
1622
1632
_LOGGER .log_action_completed_against_resource ("model" , "deployed" , self )
@@ -1654,6 +1664,7 @@ def _deploy_call(
1654
1664
disable_container_logging : bool = False ,
1655
1665
deployment_resource_pool : Optional [DeploymentResourcePool ] = None ,
1656
1666
fast_tryout_enabled : bool = False ,
1667
+ system_labels : Optional [Dict [str , str ]] = None ,
1657
1668
) -> None :
1658
1669
"""Helper method to deploy model to endpoint.
1659
1670
@@ -1767,6 +1778,9 @@ def _deploy_call(
1767
1778
If True, model will be deployed using faster deployment path.
1768
1779
Useful for quick experiments. Not for production workloads. Only
1769
1780
available for most popular models with certain machine types.
1781
+ system_labels (Dict[str, str]):
1782
+ Optional. System labels to apply to Model Garden deployments.
1783
+ System labels are managed by Google for internal use only.
1770
1784
1771
1785
Raises:
1772
1786
ValueError: If only `accelerator_type` or `accelerator_count` is specified.
@@ -1788,6 +1802,9 @@ def _deploy_call(
1788
1802
disable_container_logging = disable_container_logging ,
1789
1803
)
1790
1804
1805
+ if system_labels :
1806
+ deployed_model .system_labels = system_labels
1807
+
1791
1808
supports_shared_resources = (
1792
1809
gca_model_compat .Model .DeploymentResourcesType .SHARED_RESOURCES
1793
1810
in model .supported_deployment_resources_types
@@ -1847,6 +1864,9 @@ def _deploy_call(
1847
1864
disable_container_logging = disable_container_logging ,
1848
1865
)
1849
1866
1867
+ if system_labels :
1868
+ deployed_model .system_labels = system_labels
1869
+
1850
1870
supports_automatic_resources = (
1851
1871
gca_model_compat .Model .DeploymentResourcesType .AUTOMATIC_RESOURCES
1852
1872
in model .supported_deployment_resources_types
@@ -3911,6 +3931,7 @@ def deploy(
3911
3931
reservation_affinity_key : Optional [str ] = None ,
3912
3932
reservation_affinity_values : Optional [List [str ]] = None ,
3913
3933
spot : bool = False ,
3934
+ system_labels : Optional [Dict [str , str ]] = None ,
3914
3935
) -> None :
3915
3936
"""Deploys a Model to the PrivateEndpoint.
3916
3937
@@ -4026,6 +4047,9 @@ def deploy(
4026
4047
Format: 'projects/{project_id_or_number}/zones/{zone}/reservations/{reservation_name}'
4027
4048
spot (bool):
4028
4049
Optional. Whether to schedule the deployment workload on spot VMs.
4050
+ system_labels (Dict[str, str]):
4051
+ Optional. System labels to apply to Model Garden deployments.
4052
+ System labels are managed by Google for internal use only.
4029
4053
"""
4030
4054
4031
4055
if self .network :
@@ -4070,6 +4094,7 @@ def deploy(
4070
4094
sync = sync ,
4071
4095
spot = spot ,
4072
4096
disable_container_logging = disable_container_logging ,
4097
+ system_labels = system_labels ,
4073
4098
)
4074
4099
4075
4100
def update (
@@ -5133,6 +5158,7 @@ def deploy(
5133
5158
reservation_affinity_values : Optional [List [str ]] = None ,
5134
5159
spot : bool = False ,
5135
5160
fast_tryout_enabled : bool = False ,
5161
+ system_labels : Optional [Dict [str , str ]] = None ,
5136
5162
) -> Union [Endpoint , PrivateEndpoint ]:
5137
5163
"""Deploys model to endpoint. Endpoint will be created if unspecified.
5138
5164
@@ -5267,6 +5293,9 @@ def deploy(
5267
5293
If True, model will be deployed using faster deployment path.
5268
5294
Useful for quick experiments. Not for production workloads. Only
5269
5295
available for most popular models with certain machine types.
5296
+ system_labels (Dict[str, str]):
5297
+ Optional. System labels to apply to Model Garden deployments.
5298
+ System labels are managed by Google for internal use only.
5270
5299
5271
5300
Returns:
5272
5301
endpoint (Union[Endpoint, PrivateEndpoint]):
@@ -5336,6 +5365,7 @@ def deploy(
5336
5365
private_service_connect_config = private_service_connect_config ,
5337
5366
deployment_resource_pool = deployment_resource_pool ,
5338
5367
fast_tryout_enabled = fast_tryout_enabled ,
5368
+ system_labels = system_labels ,
5339
5369
)
5340
5370
5341
5371
@base .optional_sync (return_input_arg = "endpoint" , bind_future_to_self = False )
@@ -5371,6 +5401,7 @@ def _deploy(
5371
5401
] = None ,
5372
5402
deployment_resource_pool : Optional [DeploymentResourcePool ] = None ,
5373
5403
fast_tryout_enabled : bool = False ,
5404
+ system_labels : Optional [Dict [str , str ]] = None ,
5374
5405
) -> Union [Endpoint , PrivateEndpoint ]:
5375
5406
"""Deploys model to endpoint. Endpoint will be created if unspecified.
5376
5407
@@ -5498,6 +5529,9 @@ def _deploy(
5498
5529
If True, model will be deployed using faster deployment path.
5499
5530
Useful for quick experiments. Not for production workloads. Only
5500
5531
available for most popular models with certain machine types.
5532
+ system_labels (Dict[str, str]):
5533
+ Optional. System labels to apply to Model Garden deployments.
5534
+ System labels are managed by Google for internal use only.
5501
5535
5502
5536
Returns:
5503
5537
endpoint (Union[Endpoint, PrivateEndpoint]):
@@ -5557,6 +5591,7 @@ def _deploy(
5557
5591
disable_container_logging = disable_container_logging ,
5558
5592
deployment_resource_pool = deployment_resource_pool ,
5559
5593
fast_tryout_enabled = fast_tryout_enabled ,
5594
+ system_labels = system_labels ,
5560
5595
)
5561
5596
5562
5597
_LOGGER .log_action_completed_against_resource ("model" , "deployed" , endpoint )
0 commit comments