Fix DT update bug#46717
Open
PratibhaShrivastav18 wants to merge 1 commit intoAzure:mainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
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_typeshandling in_from_rest_object(includingadditional_propertiesfallback) 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 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") |
| @@ -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 |
…allowedInstanceType
649b506 to
098efbc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
General Guidelines and Best Practices
Testing Guidelines