Skip to content

Commit ba48e9c

Browse files
authored
add pipeline info to properties in batch-deployments (#34905)
* add pipeline info to properties * unit tests * pylint
1 parent 8d51344 commit ba48e9c

File tree

5 files changed

+35
-18
lines changed

5 files changed

+35
-18
lines changed

sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ def __init__(
565565
self._batch_deployments = BatchDeploymentOperations(
566566
self._operation_scope,
567567
self._operation_config,
568-
self._service_client_10_2023,
568+
self._service_client_01_2024_preview,
569569
self._operation_container,
570570
credentials=self._credential,
571571
requests_pipeline=self._requests_pipeline,

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

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
from pathlib import Path
1010
from typing import Any, Dict, Optional, Union
1111

12-
from azure.ai.ml._restclient.v2022_05_01.models import BatchDeploymentData
13-
from azure.ai.ml._restclient.v2022_05_01.models import BatchDeploymentDetails as RestBatchDeployment
14-
from azure.ai.ml._restclient.v2022_05_01.models import BatchOutputAction
15-
from azure.ai.ml._restclient.v2022_05_01.models import CodeConfiguration as RestCodeConfiguration
16-
from azure.ai.ml._restclient.v2022_05_01.models import IdAssetReference
12+
from azure.ai.ml._restclient.v2024_01_01_preview.models import BatchDeployment as BatchDeploymentData
13+
from azure.ai.ml._restclient.v2024_01_01_preview.models import BatchDeploymentProperties as RestBatchDeployment
14+
from azure.ai.ml._restclient.v2024_01_01_preview.models import BatchOutputAction
15+
from azure.ai.ml._restclient.v2024_01_01_preview.models import CodeConfiguration as RestCodeConfiguration
16+
from azure.ai.ml._restclient.v2024_01_01_preview.models import IdAssetReference
1717
from azure.ai.ml._schema._deployment.batch.batch_deployment import BatchDeploymentSchema
1818
from azure.ai.ml._utils._arm_id_utils import _parse_endpoint_name_from_deployment_id
1919
from azure.ai.ml.constants._common import BASE_PATH_CONTEXT_KEY, PARAMS_OVERRIDE_KEY
@@ -253,6 +253,24 @@ def _from_rest_object( # pylint: disable=arguments-renamed
253253
cls, deployment: BatchDeploymentData
254254
) -> BatchDeploymentData:
255255
modelId = deployment.properties.model.asset_id if deployment.properties.model else None
256+
257+
if hasattr(deployment.properties, "deployment_configuration"):
258+
settings = deployment.properties.deployment_configuration.settings
259+
deployment_comp_settings = {
260+
"deployment_configuration_type": deployment.properties.deployment_configuration.deployment_configuration_type, # pylint: disable=line-too-long
261+
"componentDeployment.Settings.continue_on_step_failure": settings.get(
262+
"ComponentDeployment.Settings.continue_on_step_failure", None
263+
),
264+
"default_datastore": settings.get("default_datastore", None),
265+
"default_compute": settings.get("default_compute", None),
266+
}
267+
properties = {}
268+
if deployment.properties.properties:
269+
properties.update(deployment.properties.properties)
270+
properties.update(deployment_comp_settings)
271+
else:
272+
properties = deployment.properties.properties
273+
256274
code_configuration = (
257275
CodeConfiguration._from_rest_code_configuration(deployment.properties.code_configuration)
258276
if deployment.properties.code_configuration
@@ -280,7 +298,7 @@ def _from_rest_object( # pylint: disable=arguments-renamed
280298
environment_variables=deployment.properties.environment_variables,
281299
max_concurrency_per_instance=deployment.properties.max_concurrency_per_instance,
282300
endpoint_name=_parse_endpoint_name_from_deployment_id(deployment.id),
283-
properties=deployment.properties.properties,
301+
properties=properties,
284302
creation_context=SystemData._from_rest_object(deployment.system_data),
285303
provisioning_state=deployment.properties.provisioning_state,
286304
)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from pathlib import Path
77
from typing import IO, Any, AnyStr, Dict, Optional, Union
88

9-
from azure.ai.ml._restclient.v2023_04_01_preview.models import BatchDeployment as RestBatchDeployment
10-
from azure.ai.ml._restclient.v2023_04_01_preview.models import (
9+
from azure.ai.ml._restclient.v2024_01_01_preview.models import BatchDeployment as RestBatchDeployment
10+
from azure.ai.ml._restclient.v2024_01_01_preview.models import (
1111
BatchDeploymentProperties,
1212
BatchPipelineComponentDeploymentConfiguration,
1313
IdAssetReference,

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import re
88
from typing import Any, Optional, TypeVar, Union
99

10-
from azure.ai.ml._restclient.v2022_05_01 import AzureMachineLearningWorkspaces as ServiceClient052022
10+
from azure.ai.ml._restclient.v2024_01_01_preview import AzureMachineLearningWorkspaces as ServiceClient012024Preview
1111
from azure.ai.ml._scope_dependent_operations import (
1212
OperationConfig,
1313
OperationsContainer,
@@ -64,18 +64,18 @@ def __init__(
6464
self,
6565
operation_scope: OperationScope,
6666
operation_config: OperationConfig,
67-
service_client_05_2022: ServiceClient052022,
67+
service_client_01_2024_preview: ServiceClient012024Preview,
6868
all_operations: OperationsContainer,
6969
credentials: Optional[TokenCredential] = None,
7070
**kwargs: Any,
7171
):
7272
super(BatchDeploymentOperations, self).__init__(operation_scope, operation_config)
7373
ops_logger.update_info(kwargs)
74-
self._batch_deployment = service_client_05_2022.batch_deployments
74+
self._batch_deployment = service_client_01_2024_preview.batch_deployments
7575
self._batch_job_deployment = kwargs.pop("service_client_09_2020_dataplanepreview").batch_job_deployment
7676
service_client_02_2023_preview = kwargs.pop("service_client_02_2023_preview")
7777
self._component_batch_deployment_operations = service_client_02_2023_preview.batch_deployments
78-
self._batch_endpoint_operations = service_client_05_2022.batch_endpoints
78+
self._batch_endpoint_operations = service_client_01_2024_preview.batch_endpoints
7979
self._component_operations = service_client_02_2023_preview.component_versions
8080
self._all_operations = all_operations
8181
self._credentials = credentials
@@ -191,7 +191,6 @@ def get(self, name: str, endpoint_name: str) -> BatchDeployment:
191191
:dedent: 8
192192
:caption: Get example.
193193
"""
194-
195194
deployment = BatchDeployment._from_rest_object(
196195
self._batch_deployment.get(
197196
endpoint_name=endpoint_name,

sdk/ml/azure-ai-ml/tests/batch_services/unittests/test_batch_deployment.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def mock_local_endpoint_helper() -> Mock:
6161
def mock_batch_deployment_operations(
6262
mock_workspace_scope: OperationScope,
6363
mock_operation_config: OperationConfig,
64-
mock_aml_services_2022_05_01: Mock,
64+
mock_aml_services_2024_01_01_preview: Mock,
6565
mock_aml_services_2023_02_01_preview: Mock,
6666
mock_aml_services_2020_09_01_dataplanepreview: Mock,
6767
mock_machinelearning_client: Mock,
@@ -75,7 +75,7 @@ def mock_batch_deployment_operations(
7575
yield BatchDeploymentOperations(
7676
operation_scope=mock_workspace_scope,
7777
operation_config=mock_operation_config,
78-
service_client_05_2022=mock_aml_services_2022_05_01,
78+
service_client_01_2024_preview=mock_aml_services_2024_01_01_preview,
7979
all_operations=mock_machinelearning_client._operation_container,
8080
requests_pipeline=mock_machinelearning_client._requests_pipeline,
8181
**kwargs,
@@ -125,11 +125,11 @@ def test_list_deployment_jobs(
125125
def test_delete_batch_endpoint(
126126
self,
127127
mock_batch_deployment_operations: BatchDeploymentOperations,
128-
mock_aml_services_2022_05_01: Mock,
128+
mock_aml_services_2024_01_01_preview: Mock,
129129
mocker: MockFixture,
130130
mock_delete_poller: LROPoller,
131131
) -> None:
132132
random_name = "random_name"
133-
mock_aml_services_2022_05_01.batch_deployments.begin_delete.return_value = mock_delete_poller
133+
mock_aml_services_2024_01_01_preview.batch_deployments.begin_delete.return_value = mock_delete_poller
134134
mock_batch_deployment_operations.begin_delete(endpoint_name="batch-ept", name=random_name)
135135
mock_batch_deployment_operations._batch_deployment.begin_delete.assert_called_once()

0 commit comments

Comments
 (0)