Skip to content

Commit 80ebe50

Browse files
annatischneeduv
andauthored
[AzureML] Fix BatchDeployment typevar signature + other API review comments (Azure#30354)
* Fix typevar signature * Fix pylint * black * resolve last few api comments * fix circular import * kwargs passthrough --------- Co-authored-by: Neehar Duvvuri <[email protected]>
1 parent 3d4176c commit 80ebe50

File tree

12 files changed

+35
-13
lines changed

12 files changed

+35
-13
lines changed

sdk/ml/azure-ai-ml/azure/ai/ml/_schema/core/intellectual_property.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from azure.ai.ml._schema.core.schema import PatchedSchemaMeta
1010
from azure.ai.ml._utils._experimental import experimental
1111
from azure.ai.ml._utils.utils import camel_to_snake
12-
from azure.ai.ml.constants._common import IPProtectionLevel
12+
from azure.ai.ml.constants._assets import IPProtectionLevel
1313
from azure.ai.ml.entities._assets.intellectual_property import IntellectualProperty
1414

1515

sdk/ml/azure-ai-ml/azure/ai/ml/constants/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
77

8+
from ._assets import IPProtectionLevel
89
from ._common import AssetTypes, InputOutputModes, ModelType, Scope, TimeZone
910
from ._component import ParallelTaskType
1011
from ._deployment import BatchDeploymentOutputAction
@@ -56,4 +57,5 @@
5657
"MonitorModelType",
5758
"MonitorFeatureType",
5859
"MonitorDatasetContext",
60+
"IPProtectionLevel",
5961
]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# ---------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# ---------------------------------------------------------
4+
from enum import Enum
5+
6+
from azure.ai.ml._utils._experimental import experimental
7+
from azure.core import CaseInsensitiveEnumMeta
8+
9+
10+
@experimental
11+
class IPProtectionLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta):
12+
ALL = "all"
13+
NONE = "none"

sdk/ml/azure-ai-ml/azure/ai/ml/constants/_common.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -852,11 +852,6 @@ class InferenceServerType:
852852
CUSTOM = "custom"
853853

854854

855-
class IPProtectionLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta):
856-
ALL = "all"
857-
NONE = "none"
858-
859-
860855
class AzureDevopsArtifactsType:
861856
ARTIFACT = "artifact"
862857

sdk/ml/azure-ai-ml/azure/ai/ml/entities/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,12 @@
6767
OnlineDeployment,
6868
)
6969
from ._deployment.data_collector import DataCollector
70+
from ._deployment.deployment_collection import DeploymentCollection
7071
from ._deployment.model_batch_deployment import ModelBatchDeployment
7172
from ._deployment.model_batch_deployment_settings import ModelBatchDeploymentSettings
7273
from ._deployment.pipeline_component_batch_deployment import PipelineComponentBatchDeployment
7374
from ._deployment.resource_requirements_settings import ResourceRequirementsSettings
75+
from ._deployment.request_logging import RequestLogging
7476
from ._deployment.scale_settings import DefaultScaleSettings, TargetUtilizationScaleSettings, OnlineScaleSettings
7577
from ._endpoint.batch_endpoint import BatchEndpoint
7678
from ._endpoint.endpoint import Endpoint
@@ -408,4 +410,6 @@
408410
"CustomMonitoringMetricThreshold",
409411
"DataCollector",
410412
"IntellectualProperty",
413+
"DeploymentCollection",
414+
"RequestLogging",
411415
]

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_assets/intellectual_property.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from typing import Any
66
from azure.ai.ml._utils._experimental import experimental
7-
from azure.ai.ml.constants._common import IPProtectionLevel
7+
from azure.ai.ml.constants._assets import IPProtectionLevel
88
from azure.ai.ml.entities._mixins import RestTranslatableMixin
99
from azure.ai.ml._restclient.v2023_04_01_preview.models import IntellectualProperty as RestIntellectualProperty
1010

@@ -15,7 +15,7 @@ class IntellectualProperty(RestTranslatableMixin):
1515
:param publisher: Publisher name
1616
:type publisher: str
1717
:param protection_level: Asset Protection Level. Allowed values: ALL, NONE
18-
:type protection_level: IPProtectionLevel
18+
:type protection_level: ~azure.ai.ml.constants.IPProtectionLevel
1919
"""
2020

2121
def __init__(self, *, publisher: str = None, protection_level: IPProtectionLevel = IPProtectionLevel.ALL):

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/deployment_collection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
from azure.ai.ml._schema._deployment.online.deployment_collection_schema import DeploymentCollectionSchema
88
from azure.ai.ml.constants._common import BASE_PATH_CONTEXT_KEY
99
from azure.ai.ml._restclient.v2023_04_01_preview.models import Collection as RestCollection
10+
from azure.ai.ml._utils._experimental import experimental
1011

1112

13+
@experimental
1214
class DeploymentCollection:
1315
"""Collection entity
1416

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/request_logging.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
from azure.ai.ml._schema._deployment.online.request_logging_schema import RequestLoggingSchema
88
from azure.ai.ml._restclient.v2023_04_01_preview.models import RequestLogging as RestRequestLogging
99
from azure.ai.ml.constants._common import BASE_PATH_CONTEXT_KEY
10+
from azure.ai.ml._utils._experimental import experimental
1011

1112

13+
@experimental
1214
class RequestLogging:
1315
"""Request Logging deployment entity.
1416

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def __init__(
5858
:type public_network_access: str
5959
:param discovery_url: Backend service base url for the registry.
6060
:type discovery_url: str
61-
:param intellectual_property_publisher: Intellectual property publisher.
62-
:type intellectual_property_publisher: str
61+
:param intellectual_property: **Experimental** Intellectual property publisher.
62+
:type intellectual_property: ~azure.ai.ml.entities.IntellectualProperty
6363
:param managed_resource_group: Managed resource group created for the registry.
6464
:type managed_resource_group: str
6565
:param mlflow_registry_uri: Ml flow tracking uri for the registry.

sdk/ml/azure-ai-ml/azure/ai/ml/operations/_batch_deployment_operations.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939

4040
ops_logger = OpsLogger(__name__)
4141
logger, module_logger = ops_logger.package_logger, ops_logger.module_logger
42-
DeploymentType = TypeVar("DeploymentType", bound=Union[BatchDeployment, PipelineComponentBatchDeployment])
42+
DeploymentType = TypeVar(
43+
"DeploymentType", bound=Union[BatchDeployment, PipelineComponentBatchDeployment, ModelBatchDeployment]
44+
)
4345

4446

4547
class BatchDeploymentOperations(_ScopeDependentOperations):
@@ -76,7 +78,7 @@ def __init__(
7678
@monitor_with_activity(logger, "BatchDeployment.BeginCreateOrUpdate", ActivityType.PUBLICAPI)
7779
def begin_create_or_update(
7880
self,
79-
deployment: Union[BatchDeployment, PipelineComponentBatchDeployment, ModelBatchDeployment],
81+
deployment: DeploymentType,
8082
*,
8183
skip_script_validation: bool = False,
8284
**kwargs,

0 commit comments

Comments
 (0)