Skip to content

Fix DT update bug#46717

Open
PratibhaShrivastav18 wants to merge 1 commit intoAzure:mainfrom
PratibhaShrivastav18:shrivastavp/dt-update-round-trip-fix-v2
Open

Fix DT update bug#46717
PratibhaShrivastav18 wants to merge 1 commit intoAzure:mainfrom
PratibhaShrivastav18:shrivastavp/dt-update-round-trip-fix-v2

Conversation

@PratibhaShrivastav18
Copy link
Copy Markdown
Member

@PratibhaShrivastav18 PratibhaShrivastav18 commented May 5, 2026

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the DeploymentTemplate entity serialization/deserialization to better handle service-side field name mismatches for instance type constraints and to round-trip allowedEnvironmentVariableOverrides through REST conversions.

Changes:

  • Adjusts allowed_instance_types handling in _from_rest_object (including additional_properties fallback) and _to_rest_object (string/list normalization).
  • Adds parsing/storage and round-trip emission for allowedEnvironmentVariableOverrides.
  • Minor import reordering/cleanup in deployment_template.py.

Comment thread sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/deployment_template.py Outdated
Comment on lines 99 to +104
self.code_configuration = code_configuration
self.environment_variables = environment_variables
self.app_insights_enabled = app_insights_enabled
if allowed_instance_types is not None and not isinstance(allowed_instance_types, list):
raise TypeError(
"allowed_instance_types must be a list of strings, e.g. ['Standard_DS3_v2', 'Standard_DS4_v2']."
)
self.allowed_instance_types = allowed_instance_types
self.default_instance_type = default_instance_type
self._allowed_environment_variable_overrides = None
Comment on lines 366 to +373
allowed_instance_types = get_value(properties, "allowedInstanceTypes") or get_value(
obj, "allowed_instance_types"
)
# Also check additional_properties for service fields with mismatched names
if not allowed_instance_types:
additional_props = get_value(obj, "additional_properties", {})
if isinstance(additional_props, dict):
allowed_instance_types = additional_props.get("allowedInstanceType") or additional_props.get("allowedInstanceTypes")
Comment thread sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/deployment_template.py Outdated
@@ -637,6 +666,8 @@
# Add instance configuration
if hasattr(self, "allowed_instance_types") and self.allowed_instance_types:
result["allowedInstanceTypes"] = self.allowed_instance_types # type: ignore[assignment]
Comment on lines 369 to 416
@@ -399,6 +406,13 @@
except (ValueError, SyntaxError):
allowed_instance_types = None

# Parse allowed_environment_variable_overrides if it's a string
if isinstance(allowed_environment_variable_overrides, str):
try:
allowed_environment_variable_overrides = ast.literal_eval(allowed_environment_variable_overrides)
except (ValueError, SyntaxError):
allowed_environment_variable_overrides = None

# Convert request_settings to OnlineRequestSettings object using the built-in conversion method
Comment on lines 14 to 18
from azure.ai.ml._utils._experimental import experimental
from azure.ai.ml.entities._mixins import RestTranslatableMixin
from azure.ai.ml.entities._assets import Environment

from azure.ai.ml.entities._deployment.deployment_template_settings import OnlineRequestSettings, ProbeSettings
@PratibhaShrivastav18 PratibhaShrivastav18 force-pushed the shrivastavp/dt-update-round-trip-fix-v2 branch from 649b506 to 098efbc Compare May 5, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants