Skip to content

Commit 91b5445

Browse files
authored
fix registry managed tags (#26977)
* fix registry managed tags * add testing * remove trailing whitespace * add in-line comments explaining tags * pylint pass * update swagger to match other tags exactly
1 parent a8d274f commit 91b5445

File tree

9 files changed

+891
-228
lines changed

9 files changed

+891
-228
lines changed

sdk/ml/azure-ai-ml/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
### Bugs Fixed
1313
- MLClient.from_config can now find the default config.json on Compute Instance when running sample notebooks.
14+
- Registries now assign managed tags to match registry's tags.
1415
- Adjust registry experimental tags and imports to avoid warning printouts for unrelated operations.
1516

1617
### Other Changes

sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_10_01_preview/models/_models.py

+8
Original file line numberDiff line numberDiff line change
@@ -18113,6 +18113,9 @@ class RegistryProperties(ResourceBase):
1811318113
:ivar region_details: Details of each region the registry is in.
1811418114
:vartype region_details:
1811518115
list[~azure.mgmt.machinelearningservices.models.RegistryRegionArmDetails]
18116+
:ivar managed_resource_group_tags: Tags to be applied to the managed resource group associated
18117+
with this registry.
18118+
:vartype managed_resource_group_tags: dict[str, str]
1811618119
"""
1811718120

1811818121
_attribute_map = {
@@ -18126,6 +18129,7 @@ class RegistryProperties(ResourceBase):
1812618129
'ml_flow_registry_uri': {'key': 'mlFlowRegistryUri', 'type': 'str'},
1812718130
'private_link_count': {'key': 'privateLinkCount', 'type': 'int'},
1812818131
'region_details': {'key': 'regionDetails', 'type': '[RegistryRegionArmDetails]'},
18132+
'managed_resource_group_tags': {'key': 'managedResourceGroupTags', 'type': '{str}'},
1812918133
}
1813018134

1813118135
def __init__(
@@ -18154,6 +18158,9 @@ def __init__(
1815418158
:keyword region_details: Details of each region the registry is in.
1815518159
:paramtype region_details:
1815618160
list[~azure.mgmt.machinelearningservices.models.RegistryRegionArmDetails]
18161+
:keyword managed_resource_group_tags: Tags to be applied to the managed resource group
18162+
associated with this registry.
18163+
:paramtype managed_resource_group_tags: dict[str, str]
1815718164
"""
1815818165
super(RegistryProperties, self).__init__(**kwargs)
1815918166
self.public_network_access = kwargs.get('public_network_access', None)
@@ -18163,6 +18170,7 @@ def __init__(
1816318170
self.ml_flow_registry_uri = kwargs.get('ml_flow_registry_uri', None)
1816418171
self.private_link_count = kwargs.get('private_link_count', None)
1816518172
self.region_details = kwargs.get('region_details', None)
18173+
self.managed_resource_group_tags = kwargs.get('managed_resource_group_tags', None)
1816618174

1816718175

1816818176
class RegistryRegionArmDetails(msrest.serialization.Model):

sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2022_10_01_preview/models/_models_py3.py

+9
Original file line numberDiff line numberDiff line change
@@ -19634,6 +19634,9 @@ class RegistryProperties(ResourceBase):
1963419634
:ivar region_details: Details of each region the registry is in.
1963519635
:vartype region_details:
1963619636
list[~azure.mgmt.machinelearningservices.models.RegistryRegionArmDetails]
19637+
:ivar managed_resource_group_tags: Tags to be applied to the managed resource group associated
19638+
with this registry.
19639+
:vartype managed_resource_group_tags: dict[str, str]
1963719640
"""
1963819641

1963919642
_attribute_map = {
@@ -19647,6 +19650,7 @@ class RegistryProperties(ResourceBase):
1964719650
'ml_flow_registry_uri': {'key': 'mlFlowRegistryUri', 'type': 'str'},
1964819651
'private_link_count': {'key': 'privateLinkCount', 'type': 'int'},
1964919652
'region_details': {'key': 'regionDetails', 'type': '[RegistryRegionArmDetails]'},
19653+
'managed_resource_group_tags': {'key': 'managedResourceGroupTags', 'type': '{str}'},
1965019654
}
1965119655

1965219656
def __init__(
@@ -19662,6 +19666,7 @@ def __init__(
1966219666
ml_flow_registry_uri: Optional[str] = None,
1966319667
private_link_count: Optional[int] = None,
1966419668
region_details: Optional[List["RegistryRegionArmDetails"]] = None,
19669+
managed_resource_group_tags: Optional[Dict[str, str]] = None,
1966519670
**kwargs
1966619671
):
1966719672
"""
@@ -19686,6 +19691,9 @@ def __init__(
1968619691
:keyword region_details: Details of each region the registry is in.
1968719692
:paramtype region_details:
1968819693
list[~azure.mgmt.machinelearningservices.models.RegistryRegionArmDetails]
19694+
:keyword managed_resource_group_tags: Tags to be applied to the managed resource group
19695+
associated with this registry.
19696+
:paramtype managed_resource_group_tags: dict[str, str]
1968919697
"""
1969019698
super(RegistryProperties, self).__init__(description=description, properties=properties, tags=tags, **kwargs)
1969119699
self.public_network_access = public_network_access
@@ -19695,6 +19703,7 @@ def __init__(
1969519703
self.ml_flow_registry_uri = ml_flow_registry_uri
1969619704
self.private_link_count = private_link_count
1969719705
self.region_details = region_details
19706+
self.managed_resource_group_tags = managed_resource_group_tags
1969819707

1969919708

1970019709
class RegistryRegionArmDetails(msrest.serialization.Model):

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_registry/registry.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -215,20 +215,26 @@ def _to_rest_object(self) -> RestRegistry:
215215
replication_locations = []
216216
if self.replication_locations:
217217
replication_locations = [details._to_rest_object() for details in self.replication_locations]
218+
# Notes about this construction.
219+
# RestRegistry.properties.tags: this property exists due to swagger inheritance
220+
# issues, don't actually use it, use top level RestRegistry.tags instead
221+
# RestRegistry.properties.managed_resource_group_tags: Registries create a
222+
# managed resource group to manage their internal sub-resources.
223+
# We always want the tags on this MRG to match those of the registry itself
224+
# to keep janitor policies aligned.
218225
return RestRegistry(
219226
name=self.name,
220227
location=self.location,
221228
identity=identity,
222229
tags=self.tags,
223230
description=self.description,
224231
properties=RegistryProperties(
225-
#tags=self.tags, interior tags exist due to swagger inheritance
226-
# issues, don't actually use them.
227232
public_network_access=self.public_network_access,
228233
discovery_url=self.discovery_url,
229234
intellectual_property_publisher=self.intellectual_property_publisher,
230235
managed_resource_group=self.managed_resource_group,
231236
ml_flow_registry_uri=self.mlflow_registry_uri,
232237
region_details=replication_locations,
238+
managed_resource_group_tags=self.tags,
233239
),
234240
)

sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-10-01-preview/registries.json

+8
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,14 @@
516516
},
517517
"x-ms-identifiers": [],
518518
"x-nullable": true
519+
},
520+
"managedResourceGroupTags": {
521+
"description": "Tags to be applied to the managed resource group associated with this registry.",
522+
"type": "object",
523+
"additionalProperties": {
524+
"type": "string",
525+
"x-nullable": true
526+
}
519527
}
520528
},
521529
"x-ms-client-name": "RegistryProperties",

0 commit comments

Comments
 (0)