Add MPSS model-publisher self-serve commands to ml extension#9956
Open
sanskritityagi wants to merge 10 commits into
Open
Add MPSS model-publisher self-serve commands to ml extension#9956sanskritityagi wants to merge 10 commits into
sanskritityagi wants to merge 10 commits into
Conversation
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
Hi @sanskritityagi, |
Contributor
There was a problem hiding this comment.
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.pycustom module implementing MPSS REST calls, model card tooling, and download helpers. - Wires up new
ml modelpublisher ...command groups, parameters, and help text behindprivate_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). |
116c893 to
933dbe7
Compare
Collaborator
|
ml |
a62604c to
fb00361
Compare
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
e285954 to
2ee022a
Compare
- 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
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.
Layer the
az ml modelpublishercommand group (gpu-config, plan, model, release-candidate, model-card, registry) onto themlextension. Adds the custom modulemodel_hosting.pyplus MPSS helpers inutils.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 globalAZURE_ML_CLI_PRIVATE_FEATURES_ENABLEDflag, so existing private/preview features (e.g.virtualcluster) remain gated and unchanged for current users.This lets publishers use the latest
mlcommands (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
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (azdevrequired; see.azure-pipelines/templates/azdev_setup.ymlfor the install command untilazdev==0.2.11b1is on PyPI)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.jsonautomatically.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.