-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[DO NOT MERGE] DT CLI changes #9378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1c67554
Compute connect port 22 path fix (#9082)
PratibhaShrivastav18 166e63d
CLI v2 2.39.0 (Version/changelog changes) (#9089)
PratibhaShrivastav18 a693b88
Pylint fix + History update (#9143)
PratibhaShrivastav18 5ee3862
deployment templates - CLI
kshitij-microsoft 29ca248
Update command modify
kshitij-microsoft 663d1da
make reg and version mandatory
kshitij-microsoft d9e8bce
update documentation
kshitij-microsoft 118cbef
adding changelog
kshitij-microsoft 308b156
fixing style and removing tests
kshitij-microsoft e2a7c84
Merge branch 'main' of github.com:Azure/azure-cli-extensions into ml-dev
kshitij-microsoft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
106 changes: 106 additions & 0 deletions
106
src/machinelearningservices/azext_mlv2/manual/_help/_deployment_template_help.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| # --------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # --------------------------------------------------------- | ||
|
|
||
| from knack.help_files import helps | ||
|
|
||
|
|
||
| def get_deployment_template_help(): | ||
| """Load deployment template help content.""" | ||
|
|
||
|
|
||
| helps['ml deployment-template'] = """ | ||
| type: group | ||
| short-summary: Manage Azure ML deployment templates. | ||
| long-summary: | | ||
| Deployment templates are reusable templates that define deployment configurations for Azure ML. | ||
| They support registry-based operations only (not workspace-based) and provide a way to | ||
| standardize and share deployment configurations across teams and projects. | ||
| """ | ||
|
|
||
| helps['ml deployment-template list'] = """ | ||
| type: command | ||
| short-summary: List deployment templates in a registry. | ||
| long-summary: | | ||
| List all deployment templates available in the specified registry. This command | ||
| returns all templates along with their metadata including name, version, description, and tags. | ||
| examples: | ||
| - name: List all deployment templates in a registry | ||
| text: az ml deployment-template list --registry-name myregistry | ||
| - name: List deployment templates with specific output format | ||
| text: az ml deployment-template list --registry-name myregistry --output table | ||
| """ | ||
|
|
||
| helps['ml deployment-template get'] = """ | ||
| type: command | ||
| short-summary: Get a specific deployment template by name and version. | ||
| long-summary: | | ||
| Retrieve detailed information about a specific deployment template. If version is not | ||
| specified, the latest version will be returned. | ||
| examples: | ||
| - name: Get a specific version of a deployment template | ||
| text: az ml deployment-template get --name my-template --version 1 --registry-name myregistry | ||
| """ | ||
|
|
||
| helps['ml deployment-template create'] = """ | ||
| type: command | ||
| short-summary: Create a new deployment template from a YAML file. | ||
| long-summary: | | ||
| Create a new deployment template using a YAML configuration file. The YAML file should | ||
| contain the complete deployment template definition including endpoints, parameters, and metadata. | ||
| You can override specific values using command-line parameters. | ||
| examples: | ||
| - name: Create a deployment template from a YAML file | ||
| text: az ml deployment-template create --file template.yml --registry-name myregistry | ||
| - name: Create with name and version overrides | ||
| text: az ml deployment-template create --file template.yml --name custom-template --version 2 --registry-name myregistry | ||
| - name: Create without waiting for completion | ||
| text: az ml deployment-template create --file template.yml --registry-name myregistry --no-wait | ||
| """ | ||
|
|
||
| helps['ml deployment-template update'] = """ | ||
| type: command | ||
| short-summary: Update specific fields of an existing deployment template. | ||
| long-summary: | | ||
| Update metadata fields (description and tags) of an existing deployment template without | ||
| requiring a YAML file. This command follows Azure CLI conventions and only accepts specific | ||
| field updates. Tags are merged with existing tags rather than replaced. | ||
|
|
||
| For structural changes to the deployment template (endpoints, deployment configuration, etc.), | ||
| use the 'create' command with a YAML file. | ||
| examples: | ||
| - name: Update deployment template description | ||
| text: az ml deployment-template update --name my-template --version 1 --registry-name myregistry --set "description=Updated description" | ||
| - name: Update deployment template tags | ||
| text: az ml deployment-template update --name my-template --version 1 --registry-name myregistry --set "tags=environment=production owner=ml-team" | ||
| - name: Update both description and tags | ||
| text: az ml deployment-template update --name my-template --version 1 --registry-name myregistry --set "description=Production template" --set "tags=status=active" | ||
| """ | ||
|
|
||
| helps['ml deployment-template archive'] = """ | ||
| type: command | ||
| short-summary: Archive a deployment template. | ||
| long-summary: | | ||
| Archive a deployment template to mark it as inactive. Archived templates are not | ||
| returned in list operations by default. You can archive a specific version or all | ||
| versions of a template. | ||
| examples: | ||
| - name: Archive a specific version | ||
| text: az ml deployment-template archive --name my-template --version 1 --registry-name myregistry | ||
| - name: Archive without waiting for completion | ||
| text: az ml deployment-template archive --name my-template --version 1 --registry-name myregistry --no-wait | ||
| """ | ||
|
|
||
| helps['ml deployment-template restore'] = """ | ||
| type: command | ||
| short-summary: Restore an archived deployment template. | ||
| long-summary: | | ||
| Restore a previously archived deployment template to make it active again. Restored | ||
| templates will appear in list operations. You can restore a specific version or all | ||
| versions of a template. | ||
| examples: | ||
| - name: Restore a specific version | ||
| text: az ml deployment-template restore --name my-template --version 1 --registry-name myregistry | ||
| - name: Restore without waiting for completion | ||
| text: az ml deployment-template restore --name my-template --version 1 --registry-name myregistry --no-wait | ||
| """ |
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
111 changes: 111 additions & 0 deletions
111
src/machinelearningservices/azext_mlv2/manual/_params/_deployment_template_params.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| # --------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # --------------------------------------------------------- | ||
|
|
||
| from ._common_params import ( | ||
| add_common_params, | ||
| add_description_param, | ||
| add_file_param, | ||
| add_lro_param, | ||
| add_override_param, | ||
| add_tags_param, | ||
| ) | ||
|
|
||
|
|
||
| def add_deployment_template_common_param( | ||
| c, | ||
| name_help_message="Name of the deployment template.", | ||
| version_help_message="Version of the deployment template.", | ||
| name_required=True, | ||
| version_required=True, | ||
| ): | ||
| c.argument("name", options_list=["--name", "-n"], help=name_help_message, required=name_required) | ||
| c.argument("version", options_list=["--version", "-v"], help=version_help_message, required=version_required) | ||
|
|
||
|
|
||
| def load_deployment_template_params(self): | ||
| with self.argument_context("ml deployment-template list") as c: | ||
| add_common_params(c) | ||
| c.argument( | ||
| "registry_name", | ||
| options_list=["--registry-name", "-r"], | ||
| required=True, | ||
| help=( | ||
| "Name of the registry. This is required since deployment templates " | ||
| "only support registry-name and not workspace." | ||
| ), | ||
| ) | ||
|
|
||
| with self.argument_context("ml deployment-template get") as c: | ||
| add_common_params(c) | ||
| add_deployment_template_common_param(c, name_required=True, version_required=True) | ||
| c.argument( | ||
| "registry_name", | ||
| options_list=["--registry-name", "-r"], | ||
| required=True, | ||
| help=( | ||
| "Name of the registry. This is required since deployment templates " | ||
| "only support registry-name and not workspace." | ||
| ), | ||
| ) | ||
|
|
||
| with self.argument_context("ml deployment-template create") as c: | ||
| add_common_params(c) | ||
| # Optional for create since they can come from file | ||
| add_deployment_template_common_param(c, name_required=False, version_required=False) | ||
| add_lro_param(c) | ||
| add_file_param(c, "deployment-template", "https://aka.ms/ml-cli-v2-deployment-template-yaml") | ||
| add_override_param(c) | ||
| c.argument( | ||
| "registry_name", | ||
| options_list=["--registry-name", "-r"], | ||
| required=True, | ||
| help=( | ||
| "Name of the registry. This is required since deployment templates " | ||
| "only support registry-name and not workspace." | ||
| ), | ||
| ) | ||
|
|
||
| with self.argument_context("ml deployment-template update") as c: | ||
| add_common_params(c) | ||
| add_deployment_template_common_param(c, name_required=True, version_required=True) | ||
| add_override_param(c) | ||
| add_description_param(c, help_message="Description of the deployment template.") | ||
| add_tags_param(c) | ||
| c.argument( | ||
| "registry_name", | ||
| options_list=["--registry-name", "-r"], | ||
| required=True, | ||
| help=( | ||
| "Name of the registry. This is required since deployment templates " | ||
| "only support registry-name and not workspace." | ||
| ), | ||
| ) | ||
|
|
||
| with self.argument_context("ml deployment-template archive") as c: | ||
| add_common_params(c) | ||
| add_deployment_template_common_param(c, name_required=True, version_required=True) | ||
| add_lro_param(c) | ||
| c.argument( | ||
| "registry_name", | ||
| options_list=["--registry-name", "-r"], | ||
| required=True, | ||
| help=( | ||
| "Name of the registry. This is required since deployment templates " | ||
| "only support registry-name and not workspace." | ||
| ), | ||
| ) | ||
|
|
||
| with self.argument_context("ml deployment-template restore") as c: | ||
| add_common_params(c) | ||
| add_deployment_template_common_param(c, name_required=True, version_required=True) | ||
| add_lro_param(c) | ||
| c.argument( | ||
| "registry_name", | ||
| options_list=["--registry-name", "-r"], | ||
| required=True, | ||
| help=( | ||
| "Name of the registry. This is required since deployment templates " | ||
| "only support registry-name and not workspace." | ||
| ), | ||
| ) |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getter function name should be
_ml_deployment_template_showto match the generic_update_command pattern used elsewhere in this file. The function_ml_deployment_template_showis defined in deployment_template.py (line 162) butml_deployment_template_getis referenced here as the getter, which will cause the update command to fail.