Skip to content

Commit 6074492

Browse files
Add asset id none check in dt (#45618)
* add asset id none check in dt * update changelog
1 parent e1a986a commit 6074492

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
### Bugs Fixed
88

9+
- Fixed default deployment template check to verify `asset_id` is not None before logging template information.
910
- Skip _list_secrets for identity-based datastores to prevent noisy telemetry traces.
1011

1112
### Other Changes

sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_endpoint_utils.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from pathlib import Path
1313
from typing import Any, Callable, Dict, Optional, Union
1414

15-
from azure.core.credentials import TokenCredential
1615
from azure.ai.ml._restclient.v2020_09_01_dataplanepreview.models import DataVersion, UriFileJobOutput
1716
from azure.ai.ml._utils._arm_id_utils import is_ARM_id_for_resource, is_registry_id_for_resource
1817
from azure.ai.ml._utils._logger_utils import initialize_logger_info
@@ -23,6 +22,7 @@
2322
from azure.ai.ml.entities._deployment.model_batch_deployment import ModelBatchDeployment
2423
from azure.ai.ml.exceptions import ErrorCategory, ErrorTarget, MlException, ValidationErrorType, ValidationException
2524
from azure.ai.ml.operations._operation_orchestrator import OperationOrchestrator
25+
from azure.core.credentials import TokenCredential
2626
from azure.core.exceptions import (
2727
ClientAuthenticationError,
2828
HttpResponseError,
@@ -51,9 +51,10 @@ def check_default_deployment_template(deployment: Deployment, credential: Option
5151

5252
try:
5353
import re
54+
55+
from azure.ai.ml._utils._registry_utils import get_registry_client
5456
from azure.ai.ml.constants._common import REGISTRY_VERSION_PATTERN
5557
from azure.ai.ml.entities._assets._artifacts.model import Model
56-
from azure.ai.ml._utils._registry_utils import get_registry_client
5758

5859
match = re.match(REGISTRY_VERSION_PATTERN, deployment.model, re.IGNORECASE)
5960
if not match:
@@ -78,7 +79,11 @@ def check_default_deployment_template(deployment: Deployment, credential: Option
7879

7980
model = Model._from_rest_object(model_version_data)
8081

81-
if hasattr(model, "default_deployment_template") and model.default_deployment_template:
82+
if (
83+
hasattr(model, "default_deployment_template")
84+
and model.default_deployment_template
85+
and model.default_deployment_template.asset_id
86+
):
8287
module_logger.info(
8388
"\nModel '%s' (version %s) from registry '%s' has a "
8489
"default deployment template configured.\n"

0 commit comments

Comments
 (0)