Autorest to Typespec migration of 3 Preview API versions for azure-ai-ml#47392
Open
saanikaguptamicrosoft wants to merge 10 commits into
Open
Autorest to Typespec migration of 3 Preview API versions for azure-ai-ml#47392saanikaguptamicrosoft wants to merge 10 commits into
saanikaguptamicrosoft wants to merge 10 commits into
Conversation
- Generate v2020_09_01_dataplanepreview_tsp from TypeSpec - Flip 6 source imports + 1 test + 1 conftest mock to _tsp module - Update test_batch_job.py to use TSP Model(dict) instead of msrest deserialize() - Delete legacy autorest folder
…eview - v2024_10_01_preview is superseded by v2024_10_01_preview_tsp (already in place) - v2024_07_01_preview functionality was consolidated into v2024_10_01_preview; no consumers remain - Drop unused mock_aml_services_2024_07_01_preview fixture from conftest.py
- Regenerate new TSP client v2023_02_01_preview_tsp from spec MachineLearningServices.Management.v2023_02_01_preview - Flip 5 production imports (_ml_client, sweep_sampling_algorithm, notification, inferencing_server, conftest fixture) and 2 docstrings (_job_operations, _compute_operations) - TSP client class renamed: AzureMachineLearningWorkspaces -> MachineLearningServicesClient (local alias ServiceClient022023Preview preserved) - Delete legacy autorest folder v2023_02_01_preview
- Regenerate new TSP client v2022_02_01_preview_tsp from spec MachineLearningServices.Management.v2022_02_01_preview - Flip 16 production imports (_ml_client, entities/_util, sweep_termination, sweep_fields_provider, _online_endpoint_operations, _online_deployment_operations, _local_job_invoker, _job_ops_helper, _asset_utils, import_node, parallel_job, import_job, online_endpoint, online_deployment schema, deployment, endpoint schema) - Flip 4 test imports (conftest fixture, test_endpoint_entity, test_online_endpoints, test_deployment_entity inline import) and convert 3 .deserialize() call sites in test_endpoint_entity + test_deployment_entity to TSP-compatible _deserialize(Model, dict) (free helper) - Drop dead endpoint= kwarg from RestOnlineEndpoint construction in online_endpoint._to_rest_online_endpoint_traffic_update; field doesn't exist on OnlineEndpointDetails (TSP rejects unknown kwargs; autorest silently swallowed) - TSP client class renamed: AzureMachineLearningWorkspaces -> MachineLearningServicesClient (local alias ServiceClient022022Preview preserved) - Delete legacy autorest folder v2022_02_01_preview
RestAzureMLOnlineInferencingServer was bound twice in the module: first from v2023_02_01_preview_tsp and then re-imported from v2023_08_01_preview. Python's last-binding-wins rule meant the first import was already dead code; the v2023_08 binding was the one being used at runtime. Removing the dead first import. No functional change (verified: the rest class still resolves to v2023_08_01_preview.models._models_py3 after the change).
ImportJob._to_rest_object() always submits via service_client_01_2025_preview (see JobOperations._create_or_update_with_different_version_api, COMMAND branch). It was historically constructing v2022 autorest CommandJob/JobBaseData and relying on msrest cross-version serialization to produce a v2025-compatible body. When v2022_02_01_preview was migrated to TSP (commit 06e7793), import_job.py's rest-model imports flipped to v2022 TSP. The v2025 autorest client received a TSP-shaped object (no msrest _attribute_map; rest_field descriptors) and emitted a body shape that no longer matched recordings, producing test-proxy 404s with body diff '.properties.isArchived: Missing in record JSON' on the 3 import_job e2e tests (test_import_job_submit_cancel, test_import_node_submit_cancel, test_import_job_download). Fix: import CommandJob and JobBase from v2025_01_01_preview directly. Same-version end-to-end (entity model matches the api-version actually invoked), no msrest cross-version coupling, and v2025 autorest is what main was effectively producing on the wire pre-PR. v2022 TSP migration intent preserved (v2022 autorest folder remains deleted).
…ber on TSP .serialize/.deserialize callsites
…eserialize(d) -> ._deserialize(d, []); drop pylint suppressions
…1_preview_tsp op The dispatch in _batch_deployment_operations.py routes pipeline batch deployments to service_client_02_2023_preview.batch_deployments (TSP-migrated in 425393c). That op serializes body= via SdkJSONEncoder, which TypeErrors on the legacy msrest v2024_01_01_preview.BatchDeployment that _to_rest_object() returned. - pipeline_component_batch_deployment.py: import BatchDeployment / BatchDeploymentProperties / BatchPipelineComponentDeploymentConfiguration / IdAssetReference from v2023_02_01_preview_tsp.models. _to_rest_object body is now TSP-native (encoder serializes cleanly). _from_rest_object uses proper field access (deployment_configuration.component_id.asset_id) instead of msrest additional_properties dict-digging. - test_pipeline_component_bach_deployment.py: imports flipped to TSP, fixture loaded via Model._deserialize, and a new test_to_rest_object_is_json_serializable_by_tsp_encoder regression test pins the wire-serialization contract that 5 sample-pipelines exposed.
Contributor
Author
|
TODO: tsp-location needs to be updated as tsp is currently in remote branch |
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.
v2020_09_01_dataplanepreview,v2022_02_01_preview,v2023_02_01_preview(rows 1, 4, 7 in typespec_migration_status.md).Testing:
SDK Samples Run generated from 6408715 azureml-examples#4021,SDK Samples Run generated from 6410734 azureml-examples#4023, SDK Samples Run generated from 6411241 azureml-examples#4024Description
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