Skip to content
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

[Quantum] Expand help and error messages about Provider/SKU format #4603

Merged
merged 3 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/quantum/azext_quantum/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
examples:
- name: List offerings available in an Azure location.
text: |-
az quantum offerings list -l MyLocation
az quantum offerings list -l MyLocation -o table
"""

helps['quantum offerings show-terms'] = """
Expand Down Expand Up @@ -203,7 +203,9 @@
- name: Create a new Azure Quantum workspace with a specific list of providers.
text: |-
az quantum workspace create -g MyResourceGroup -w MyWorkspace -l MyLocation \\
-r "MyProvider1 / MySKU1, MyProvider2 / MySKU2" -a MyStorageAccountName
-r "MyProvider1 / MySKU1, MyProvider2 / MySKU2" -a MyStorageAccountName\n
To display a list of available providers and their SKUs, use the following command:
az quantum offerings list -l MyLocation -o table
"""

helps['quantum workspace delete'] = """
Expand Down
2 changes: 1 addition & 1 deletion src/quantum/azext_quantum/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def load_arguments(self, _):
skip_role_assignment_type = CLIArgumentType(help='Skip the role assignment step for the quantum workspace in the storage account.')
provider_id_type = CLIArgumentType(options_list=['--provider-id', '-p'], help='Identifier of an Azure Quantum provider.')
sku_type = CLIArgumentType(options_list=['--sku', '-k'], help='Identify a plan or SKU offered by an Azure Quantum provider.')
provider_sku_list_type = CLIArgumentType(options_list=['--provider-sku-list', '-r'], help='Comma separated list of Provider/SKU pairs.')
provider_sku_list_type = CLIArgumentType(options_list=['--provider-sku-list', '-r'], help='Comma separated list of Provider/SKU pairs. Separate the Provider and SKU with a slash. Enclose the entire list in quotes. Values from `az quantum offerings list -l <location> -o table`')

with self.argument_context('quantum workspace') as c:
c.argument('workspace_name', workspace_name_type)
Expand Down
4 changes: 2 additions & 2 deletions src/quantum/azext_quantum/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def creation(job):
def transform_offerings(offerings):
def one(offering):
return OrderedDict([
('Provider Id', offering['id']),
('SKUs', ', '.join([s['id'] for s in offering['properties']['skus']])),
('Provider ID', offering['id']),
('SKU', ', '.join([s['id'] for s in offering['properties']['skus']])),
('Publisher ID', offering['properties']['managedApplication']['publisherId']),
('Offer ID', offering['properties']['managedApplication']['offerId'])
])
Expand Down
6 changes: 5 additions & 1 deletion src/quantum/azext_quantum/operations/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,11 @@ def create(cmd, resource_group_name=None, workspace_name=None, location=None, st
if not location:
raise RequiredArgumentMissingError("A location for the new quantum workspace is required.")
if provider_sku_list is None:
raise RequiredArgumentMissingError("A list of Azure Quantum providers and SKUs is required.")
raise RequiredArgumentMissingError("A list of Azure Quantum providers and SKUs is required.",
"Supply the missing -r parameter. For example:\n"
"\t-r \"Microsoft/Basic, Microsoft.FleetManagement/Basic\"\n"
"To display a list of Provider IDs and their SKUs, use the following command:\n"
"\taz quantum offerings list -l MyLocation -o table")
info = WorkspaceInfo(cmd, resource_group_name, workspace_name, location)
if not info.resource_group:
raise ResourceNotFoundError("Please run 'az quantum workspace set' first to select a default resource group.")
Expand Down