Skip to content

Add MPSS model-publisher self-serve commands to ml extension#9956

Open
sanskritityagi wants to merge 10 commits into
Azure:mainfrom
sanskritityagi:mpss-self-serve
Open

Add MPSS model-publisher self-serve commands to ml extension#9956
sanskritityagi wants to merge 10 commits into
Azure:mainfrom
sanskritityagi:mpss-self-serve

Conversation

@sanskritityagi

@sanskritityagi sanskritityagi commented Jun 18, 2026

Copy link
Copy Markdown

Layer the az ml modelpublisher command group (gpu-config, plan, model, release-candidate, model-card, registry) onto the ml extension. Adds the custom module model_hosting.py plus MPSS helpers in utils.py.

The command group is registered as a normal preview surface (is_preview=True) — available without setting any private-feature env var — so publishers get it with no extra setup. It does not flip the global AZURE_ML_CLI_PRIVATE_FEATURES_ENABLED flag, so existing private/preview features (e.g. virtualcluster) remain gated and unchanged for current users.

This lets publishers use the latest ml commands (e.g. deployment-template) and the modelpublisher commands from a single extension instead of swapping between two.


This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (azdev required; see .azure-pipelines/templates/azdev_setup.yml for the install command until azdev==0.2.11b1 is on PyPI)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Copilot AI review requested due to automatic review settings June 18, 2026 15:57
@azure-client-tools-bot-prd

Copy link
Copy Markdown
Validation for Breaking Change Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi @sanskritityagi,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

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.

Pull request overview

This PR introduces a new private-preview az ml modelpublisher command surface for MPSS model-publisher self-serve workflows, including GPU config, plan details, model lifecycle, release candidates, and model card operations, plus supporting config/helpers and samples.

Changes:

  • Adds a new model_hosting.py custom module implementing MPSS REST calls, model card tooling, and download helpers.
  • Wires up new ml modelpublisher ... command groups, parameters, and help text behind private_features_enabled().
  • Adds self-serve endpoint config + sample YAML payloads, and updates packaging/dependencies to include the new config and tooling.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 21 comments.

Show a summary per file
File Description
src/machinelearningservices/setup.py Includes self-serve JSON config in extension package data.
src/machinelearningservices/samples/maas-self-serve/publisher-registry.yaml Sample publisher registry YAML payload.
src/machinelearningservices/samples/maas-self-serve/model-version-create.yaml Sample model version create YAML payload.
src/machinelearningservices/samples/maas-self-serve/model-update.yaml Sample model update YAML payload.
src/machinelearningservices/samples/maas-self-serve/model-hosting-ptu.yaml Sample provisioned hosting YAML payload.
src/machinelearningservices/samples/maas-self-serve/model-hosting-ppt.yaml Sample pay-per-token hosting YAML payload.
src/machinelearningservices/samples/maas-self-serve/model-hosting-plan.yaml Sample marketplace plan YAML payload.
src/machinelearningservices/samples/maas-self-serve/model-create.yaml Sample model create YAML payload.
src/machinelearningservices/azext_mlv2/manual/requirements.txt Adds registry tooling dependency used by model card commands.
src/machinelearningservices/azext_mlv2/manual/custom/utils.py Adds MPSS endpoint resolution, registry-mgmt runner, and model card YAML/MD loader helpers.
src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py New MPSS modelpublisher command implementations (REST calls + model card tooling).
src/machinelearningservices/azext_mlv2/manual/custom/init.py Exposes model_hosting custom commands via wildcard import.
src/machinelearningservices/azext_mlv2/manual/config/self-serve-config.json Adds endpoint target mapping/aliases for MPSS environments.
src/machinelearningservices/azext_mlv2/manual/commands.py Registers new ml modelpublisher ... command groups when private features are enabled.
src/machinelearningservices/azext_mlv2/manual/_params/_model_hosting_params.py Defines CLI parameters for modelpublisher command groups.
src/machinelearningservices/azext_mlv2/manual/_params/init.py Conditionally loads modelpublisher params behind private feature gate.
src/machinelearningservices/azext_mlv2/manual/_help/_model_hosting_help.py Adds help entries for the modelpublisher command groups/commands.
src/machinelearningservices/azext_mlv2/manual/_help/init.py Registers the new modelpublisher help content.
src/machinelearningservices/azext_mlv2/init.py Updates extension initialization (currently also toggles private features env var).

Comment thread src/machinelearningservices/azext_mlv2/__init__.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/requirements.txt Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/_params/_model_hosting_params.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/_help/_model_hosting_help.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/samples/maas-self-serve/publisher-registry.yaml Outdated

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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 18 comments.

Comment thread src/machinelearningservices/azext_mlv2/__init__.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/_help/__init__.py
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/samples/maas-self-serve/publisher-registry.yaml Outdated

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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 19 comments.

Comment thread src/machinelearningservices/azext_mlv2/__init__.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/commands.py Outdated
@yonzhan

yonzhan commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

ml

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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.

Comment thread src/machinelearningservices/azext_mlv2/__init__.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/utils.py

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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 10 comments.

Comment thread src/machinelearningservices/azext_mlv2/manual/commands.py
Comment thread src/machinelearningservices/azext_mlv2/manual/commands.py
Comment thread src/machinelearningservices/azext_mlv2/manual/_help/__init__.py
Comment thread src/machinelearningservices/azext_mlv2/manual/_params/__init__.py
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/__init__.py
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/utils.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/requirements.txt Outdated

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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 8 comments.

Comment thread src/machinelearningservices/azext_mlv2/manual/custom/utils.py
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/utils.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/commands.py

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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 6 comments.

Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/utils.py
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/utils.py
Comment thread src/machinelearningservices/azext_mlv2/manual/commands.py
santyagi and others added 9 commits June 21, 2026 14:22
Layer the 'az ml modelpublisher' command group (gpu-config, plan, model,
release-candidate, model-card, registry) onto ml v2.43.0. New custom module
model_hosting.py + MPSS helpers in utils.py; gated behind private features.
- Bump ml extension to 2.44.0 + HISTORY.rst entry for modelpublisher commands
- Use custom_show_command for modelpublisher show commands
- Add missing command/parameter help (model-card-internal, plan update --status)
- Drop multi-character short options flagged by linter
- Fix flake8 (f-strings, blank lines, None comparison, unused vars, import order)
- Satisfy pylint (unused-argument, broad-except, no-else-return, useless-return)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- make_request now raises BadRequest/Forbidden/ResourceNotFound on 4xx
  instead of logging and returning None (commands no longer silently 'succeed')
- Pass --location through to get_self_serve_base_url in gpu-config and plan
  handlers so requests route to the intended environment
- model-card attach: send JSON body instead of a dict (correct content-type)
- Guard download when no filename can be determined (clear error vs TypeError)
- run_registry_mgmt_cmd: check=True and surface failures as a CLI error
- Gate modelpublisher help behind private_features_enabled (consistent gating)
- Use a placeholder tenantId in the sample
- Fix typos (deprecated, existing)
- Remove the unconditional AZURE_ML_CLI_PRIVATE_FEATURES_ENABLED=True from
  azext_mlv2/__init__.py (it enabled ALL private/preview features for every user)
- Register 'az ml modelpublisher' as a normal preview command group (un-gate it
  in commands.py, _params, and _help) so publishers get it without setting an
  env var, while virtualcluster / private job & component features stay gated
- Guard validate_config_file against empty/non-mapping YAML (clear error vs TypeError)
- make_request now treats any 2xx (201/202/204) as success and handles empty
  bodies, instead of only 200 (other success codes were raised as errors)
- Download streams to disk via iter_content instead of buffering the full body
- Fix help text grammar ('for a given publisher') and wording ('Microsoft PMs')
… dep

- Add a network timeout to all MPSS and model-card-template HTTP calls so a
  hung connection can't block the CLI
- Sanitize downloaded filename to a basename (prevent path traversal from a
  server-supplied content-disposition header)
- generate-template now raises on download failure instead of exiting success
- _load_self_serve_config raises FileOperationError (CLI-friendly) not Exception
- Pin azureml-registry-tools==0.1.0a58
- Read self-serve config with explicit UTF-8 encoding (portability on non-UTF-8 locales)
- run_registry_mgmt_cmd raises CLIInternalError (clean message) instead of passing a string to log_and_raise_error
- make_request drops unset (None) query params so pagination isn't sent as currentPage=None
- Chain the original exception (from e) when re-raising in model-card update
- Fix help text spacing ('model .' -> 'model.')
…rrors

- _download_file_from_response accepts any 2xx (consistent with make_request)
- run_registry_mgmt_cmd raises an actionable error if 'registry-mgmt' is not installed/on PATH
- model-card apply fails with InvalidArgumentValueError on a malformed --model-id
  (and a clear error if registry info can't be resolved) instead of silently succeeding
- _load_self_serve_config converts JSON parse errors into FileOperationError

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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 6 comments.

Comment thread src/machinelearningservices/azext_mlv2/manual/custom/model_hosting.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/utils.py
Comment thread src/machinelearningservices/azext_mlv2/manual/custom/utils.py Outdated
Comment thread src/machinelearningservices/azext_mlv2/manual/commands.py
Comment thread src/machinelearningservices/azext_mlv2/manual/commands.py
- plan show builds a clean base URL and passes offerId/planId via params
  (avoids fragile ternary URL concatenation / encoding issues)
- get_registry_info fails with a clear error if subscription/resource group
  can't be resolved for the registry (instead of '--subscription None')
- load_inline_md_files opens with UTF-8 and validates the YAML is a mapping

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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated no new comments.

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.

4 participants