Skip to content

Migrate v2022_02_01_preview consumers to shared arm_ml_service client#47554

Open
saanikaguptamicrosoft wants to merge 3 commits into
Azure:mainfrom
saanikaguptamicrosoft:saanika/tsp_migrate
Open

Migrate v2022_02_01_preview consumers to shared arm_ml_service client#47554
saanikaguptamicrosoft wants to merge 3 commits into
Azure:mainfrom
saanikaguptamicrosoft:saanika/tsp_migrate

Conversation

@saanikaguptamicrosoft

Copy link
Copy Markdown
Contributor

Reuse the existing arm_ml_service generated client for the v2022_02_01_preview API surface instead of importing from the per-version restclient package, and delete azure/ai/ml/_restclient/v2022_02_01_preview/ (76 files).

  • _ml_client: wire the v2022_02_01_preview service client via a partial of MachineLearningServicesMgmtClient with api_version='2022-02-01-preview'.
  • Switch production imports (operations, entities, schema, utils) from azure.ai.ml._restclient.v2022_02_01_preview to azure.ai.ml._restclient.arm_ml_service and map the renamed hybrid models (JobBaseData -> JobBase, BatchDeploymentData -> BatchDeployment, OnlineEndpointData -> OnlineEndpoint, OnlineEndpointDetails -> OnlineEndpointProperties).
  • entities/_endpoint/online_endpoint.py: preserve the legacy 'endpoint' field on the wire via dict-style assignment since the new hybrid OnlineEndpointProperties model does not accept it as a constructor kwarg.
  • entities/_util.py: normalize_job_input_output_type now uses hard-coded camel-case keys ('Literal', 'UriFile', 'MlFlowModel', 'MlTable', ...) so it no longer depends on the v2022 generated JobInputType enum. The arm_ml_service JobInputType uses snake_case values and would silently break the v2022_02_01_preview payload normalization path that test_pipeline_component_entity / test_pipeline_job_entity exercise.
  • Update affected unit tests to import from arm_ml_service.
  • Delete the now-unused azure/ai/ml/_restclient/v2022_02_01_preview/ package.

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.

Reuse the existing arm_ml_service generated client for the v2022_02_01_preview
API surface instead of importing from the per-version restclient package, and
delete azure/ai/ml/_restclient/v2022_02_01_preview/ (76 files).

- _ml_client: wire the v2022_02_01_preview service client via a partial of
  MachineLearningServicesMgmtClient with api_version='2022-02-01-preview'.
- Switch production imports (operations, entities, schema, utils) from
  azure.ai.ml._restclient.v2022_02_01_preview to
  azure.ai.ml._restclient.arm_ml_service and map the renamed hybrid models
  (JobBaseData -> JobBase, BatchDeploymentData -> BatchDeployment,
  OnlineEndpointData -> OnlineEndpoint,
  OnlineEndpointDetails -> OnlineEndpointProperties).
- entities/_endpoint/online_endpoint.py: preserve the legacy 'endpoint' field
  on the wire via dict-style assignment since the new hybrid
  OnlineEndpointProperties model does not accept it as a constructor kwarg.
- entities/_util.py: normalize_job_input_output_type now uses hard-coded
  camel-case keys ('Literal', 'UriFile', 'MlFlowModel', 'MlTable', ...) so it
  no longer depends on the v2022 generated JobInputType enum. The
  arm_ml_service JobInputType uses snake_case values and would silently break
  the v2022_02_01_preview payload normalization path that
  test_pipeline_component_entity / test_pipeline_job_entity exercise.
- Update affected unit tests to import from arm_ml_service.
- Delete the now-unused azure/ai/ml/_restclient/v2022_02_01_preview/ package.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

The v2024_07_01_preview package had zero production consumers (datastore was consolidated onto 2024-10-01-preview earlier). The only remaining reference was an unused mock_aml_services_2024_07_01_preview conftest fixture; the equivalent mock_aml_services_2024_10_01_preview fixture already exists and points at the v2024_10_01_preview_tsp client. Delete the 76-file package and the stale fixture.
Reuse the existing arm_ml_service generated client for the v2025_01_01_preview
API surface instead of importing from the per-version restclient package, and
delete azure/ai/ml/_restclient/v2025_01_01_preview/.

- _ml_client: wire the v2025_01_01_preview service client via a partial of
  MachineLearningServicesMgmtClient with api_version='2025-01-01-preview'.
- Switch production imports (command builder/entity, job_resource_configuration,
  to_rest_functions, capability_host entity + operations) from
  azure.ai.ml._restclient.v2025_01_01_preview to
  azure.ai.ml._restclient.arm_ml_service.
- command_job.py: the shared CommandJob hybrid model does not declare
  parent_job_name, but it is a real field on the 2025-01-01-preview wire
  contract (wire key 'parentJobName'). Preserve it via dict-style assignment on
  the rest model rather than passing it as a constructor kwarg, and read it back
  via dict access in _load_from_rest.
- job_resource_configuration.py: same situation for max_instance_count
  (wire key 'maxInstanceCount', still declared on v2023_04_01_preview). Set it on
  the wire via dict assignment on the 202501 branch and read it back via
  obj.get('maxInstanceCount') for the hybrid model. Verified the value survives
  serialization and round-trip.
- Update conftest mock fixture and capability host entity test to import from
  arm_ml_service.
- test_command_job_schema: environment_variables is Dict[str, str] on the REST
  contract; the shared client coerces values to strings, so assert against the
  stringified expected values.
- Delete the now-unused azure/ai/ml/_restclient/v2025_01_01_preview/ package.
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