Skip to content

fix registry managed tags #26977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/ml/azure-ai-ml/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

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

### Other Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18113,6 +18113,9 @@ class RegistryProperties(ResourceBase):
:ivar region_details: Details of each region the registry is in.
:vartype region_details:
list[~azure.mgmt.machinelearningservices.models.RegistryRegionArmDetails]
:ivar managed_resource_group_tags: Tags to be applied to the managed resource group associated
with this registry.
:vartype managed_resource_group_tags: dict[str, str]
"""

_attribute_map = {
Expand All @@ -18126,6 +18129,7 @@ class RegistryProperties(ResourceBase):
'ml_flow_registry_uri': {'key': 'mlFlowRegistryUri', 'type': 'str'},
'private_link_count': {'key': 'privateLinkCount', 'type': 'int'},
'region_details': {'key': 'regionDetails', 'type': '[RegistryRegionArmDetails]'},
'managed_resource_group_tags': {'key': 'managedResourceGroupTags', 'type': '{str}'},
}

def __init__(
Expand Down Expand Up @@ -18154,6 +18158,9 @@ def __init__(
:keyword region_details: Details of each region the registry is in.
:paramtype region_details:
list[~azure.mgmt.machinelearningservices.models.RegistryRegionArmDetails]
:keyword managed_resource_group_tags: Tags to be applied to the managed resource group
associated with this registry.
:paramtype managed_resource_group_tags: dict[str, str]
"""
super(RegistryProperties, self).__init__(**kwargs)
self.public_network_access = kwargs.get('public_network_access', None)
Expand All @@ -18163,6 +18170,7 @@ def __init__(
self.ml_flow_registry_uri = kwargs.get('ml_flow_registry_uri', None)
self.private_link_count = kwargs.get('private_link_count', None)
self.region_details = kwargs.get('region_details', None)
self.managed_resource_group_tags = kwargs.get('managed_resource_group_tags', None)


class RegistryRegionArmDetails(msrest.serialization.Model):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19634,6 +19634,9 @@ class RegistryProperties(ResourceBase):
:ivar region_details: Details of each region the registry is in.
:vartype region_details:
list[~azure.mgmt.machinelearningservices.models.RegistryRegionArmDetails]
:ivar managed_resource_group_tags: Tags to be applied to the managed resource group associated
with this registry.
:vartype managed_resource_group_tags: dict[str, str]
"""

_attribute_map = {
Expand All @@ -19647,6 +19650,7 @@ class RegistryProperties(ResourceBase):
'ml_flow_registry_uri': {'key': 'mlFlowRegistryUri', 'type': 'str'},
'private_link_count': {'key': 'privateLinkCount', 'type': 'int'},
'region_details': {'key': 'regionDetails', 'type': '[RegistryRegionArmDetails]'},
'managed_resource_group_tags': {'key': 'managedResourceGroupTags', 'type': '{str}'},
}

def __init__(
Expand All @@ -19662,6 +19666,7 @@ def __init__(
ml_flow_registry_uri: Optional[str] = None,
private_link_count: Optional[int] = None,
region_details: Optional[List["RegistryRegionArmDetails"]] = None,
managed_resource_group_tags: Optional[Dict[str, str]] = None,
**kwargs
):
"""
Expand All @@ -19686,6 +19691,9 @@ def __init__(
:keyword region_details: Details of each region the registry is in.
:paramtype region_details:
list[~azure.mgmt.machinelearningservices.models.RegistryRegionArmDetails]
:keyword managed_resource_group_tags: Tags to be applied to the managed resource group
associated with this registry.
:paramtype managed_resource_group_tags: dict[str, str]
"""
super(RegistryProperties, self).__init__(description=description, properties=properties, tags=tags, **kwargs)
self.public_network_access = public_network_access
Expand All @@ -19695,6 +19703,7 @@ def __init__(
self.ml_flow_registry_uri = ml_flow_registry_uri
self.private_link_count = private_link_count
self.region_details = region_details
self.managed_resource_group_tags = managed_resource_group_tags


class RegistryRegionArmDetails(msrest.serialization.Model):
Expand Down
10 changes: 8 additions & 2 deletions sdk/ml/azure-ai-ml/azure/ai/ml/entities/_registry/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,20 +215,26 @@ def _to_rest_object(self) -> RestRegistry:
replication_locations = []
if self.replication_locations:
replication_locations = [details._to_rest_object() for details in self.replication_locations]
# Notes about this construction.
# RestRegistry.properties.tags: this property exists due to swagger inheritance
# issues, don't actually use it, use top level RestRegistry.tags instead
# RestRegistry.properties.managed_resource_group_tags: Registries create a
# managed resource group to manage their internal sub-resources.
# We always want the tags on this MRG to match those of the registry itself
# to keep janitor policies aligned.
return RestRegistry(
name=self.name,
location=self.location,
identity=identity,
tags=self.tags,
description=self.description,
properties=RegistryProperties(
#tags=self.tags, interior tags exist due to swagger inheritance
# issues, don't actually use them.
public_network_access=self.public_network_access,
discovery_url=self.discovery_url,
intellectual_property_publisher=self.intellectual_property_publisher,
managed_resource_group=self.managed_resource_group,
ml_flow_registry_uri=self.mlflow_registry_uri,
region_details=replication_locations,
managed_resource_group_tags=self.tags,
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,14 @@
},
"x-ms-identifiers": [],
"x-nullable": true
},
"managedResourceGroupTags": {
"description": "Tags to be applied to the managed resource group associated with this registry.",
"type": "object",
"additionalProperties": {
"type": "string",
"x-nullable": true
}
}
},
"x-ms-client-name": "RegistryProperties",
Expand Down
Loading