Skip to content
Draft
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
4 changes: 4 additions & 0 deletions src/quantum/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

1.0.0b17
+++++++++++++++
* Added ``--workspace-kind`` parameter to ``az quantum workspace create`` to support creating V2 workspaces.

1.0.0b16
+++++++++++++++
* Removed deprecated ``--location``/``-l`` parameter from ``quantum execute``, ``quantum run``, ``quantum job submit``, ``quantum job cancel``, ``quantum job list``, ``quantum job output``, ``quantum job show``, ``quantum job wait``, ``quantum target list``, ``quantum workspace set``, and ``quantum workspace quotas`` commands.
Expand Down
4 changes: 4 additions & 0 deletions src/quantum/azext_quantum/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@
-r "MyProvider1 / MySKU1, MyProvider2 / MySKU2" --skip-autoadd -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
- name: Create a new Azure Quantum V2 workspace.
text: |-
az quantum workspace create -g MyResourceGroup -w MyWorkspace -l MyLocation \\
-a MyStorageAccountName --workspace-kind V2
"""

helps['quantum workspace delete'] = """
Expand Down
2 changes: 2 additions & 0 deletions src/quantum/azext_quantum/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def load_arguments(self, _): # pylint: disable=too-many-locals
job_output_format_type = CLIArgumentType(help='The expected job output format')
entry_point_type = CLIArgumentType(help='The entry point for the QIR program or circuit. Required for some provider QIR jobs.')
skip_autoadd_type = CLIArgumentType(help='If specified, the plans that offer free credits will not automatically be added.')
workspace_kind_type = CLIArgumentType(options_list=['--workspace-kind'], help='The kind of the workspace to create.', choices=['V1', 'V2'])
key_type = CLIArgumentType(options_list=['--key-type'], help='The api keys to be regenerated, should be Primary and/or Secondary.')
enable_key_type = CLIArgumentType(options_list=['--enable-api-key'], help='Enable or disable API key authentication.')
job_type_type = CLIArgumentType(options_list=['--job-type'], help='Job type to be listed, example "QuantumComputing".')
Expand All @@ -75,6 +76,7 @@ def load_arguments(self, _): # pylint: disable=too-many-locals
c.argument('provider_sku_list', provider_sku_list_type)
c.argument('auto_accept', auto_accept_type)
c.argument('skip_autoadd', skip_autoadd_type)
c.argument('workspace_kind', workspace_kind_type)
Comment thread
s-ddavydenko marked this conversation as resolved.

with self.argument_context('quantum target') as c:
c.argument('workspace_name', workspace_name_type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@
"metadata": {
"description": "Whether to allow shared key access on the storage account. Defaults to false (secure) for new accounts; existing accounts should pass their current value to avoid breaking changes."
}
},
"workspaceKind": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "The kind of workspace to create: V1 or V2. Empty string defaults to V1."
}
}
Comment on lines +73 to 79
},
"functions": [],
Expand All @@ -88,7 +95,8 @@
},
"properties": {
"providers": "[parameters('providers')]",
"storageAccount": "[parameters('storageAccountId')]"
"storageAccount": "[parameters('storageAccountId')]",
"workspaceKind": "[if(empty(parameters('workspaceKind')), 'V1', parameters('workspaceKind'))]"
}
},
{
Expand Down
6 changes: 4 additions & 2 deletions src/quantum/azext_quantum/operations/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def _validate_storage_account(tier_or_kind_msg_text, tier_or_kind, supported_tie


def create(cmd, resource_group_name, workspace_name, location, storage_account, skip_role_assignment=False,
provider_sku_list=None, auto_accept=False, skip_autoadd=False):
provider_sku_list=None, auto_accept=False, skip_autoadd=False, workspace_kind=None):
"""
Create a new Azure Quantum workspace.
"""
Expand All @@ -215,6 +215,7 @@ def create(cmd, resource_group_name, workspace_name, location, storage_account,
if skip_role_assignment:
_add_quantum_providers(cmd, quantum_workspace, provider_sku_list, auto_accept, skip_autoadd)
quantum_workspace.properties.api_key_enabled = True
quantum_workspace.properties.workspace_kind = workspace_kind
poller = client.begin_create_or_update(info.resource_group, info.name, quantum_workspace, polling=False)
while not poller.done():
time.sleep(POLLING_TIME_DURATION)
Expand Down Expand Up @@ -269,7 +270,8 @@ def create(cmd, resource_group_name, workspace_name, location, storage_account,
'storageAccountSku': storage_account_sku,
'storageAccountKind': storage_account_kind,
'storageAccountAllowSharedKeyAccess': storage_account_allow_shared_key_access,
'storageAccountDeploymentName': "Microsoft.StorageAccount-" + time.strftime("%d-%b-%Y-%H-%M-%S", time.gmtime())
'storageAccountDeploymentName': "Microsoft.StorageAccount-" + time.strftime("%d-%b-%Y-%H-%M-%S", time.gmtime()),
'workspaceKind': workspace_kind or ''
Comment thread
s-ddavydenko marked this conversation as resolved.
}
parameters = {k: {'value': v} for k, v in parameters.items()}

Expand Down
15 changes: 15 additions & 0 deletions src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,18 @@ def test_autoadd_providers(self):
workspace_location = None
_autoadd_providers(cmd, providers_in_region, providers_selected, workspace_location, True)
assert providers_selected[0] == {"provider_id": "foo", "sku": "foo_credits_for_all_plan", "offer_id": "foo_offer", "publisher_id": "foo0123456789"}

def test_workspace_kind(self):
from ...vendored_sdks.azure_mgmt_quantum.models import WorkspaceResourceProperties, WorkspaceKind

# No kind set: field must be absent from the serialized body (not null)
assert "workspaceKind" not in WorkspaceResourceProperties().serialize()

# V1 and V2 serialize to their expected wire values
assert WorkspaceResourceProperties(workspace_kind=WorkspaceKind.V1).serialize().get("workspaceKind") == "V1"
assert WorkspaceResourceProperties(workspace_kind=WorkspaceKind.V2).serialize().get("workspaceKind") == "V2"

# workspace_kind can be assigned after construction (skip_role_assignment path)
props = WorkspaceResourceProperties()
props.workspace_kind = WorkspaceKind.V2
assert props.serialize().get("workspaceKind") == "V2"
2 changes: 1 addition & 1 deletion src/quantum/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# This version should match the latest entry in HISTORY.rst
# Also, when updating this, please review the version used by the extension to
# submit requests, which can be found at './azext_quantum/__init__.py'
VERSION = '1.0.0b16'
VERSION = '1.0.0b17'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
Loading