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

1.0.0b12
+++++++++++++++
* Added support for Data Plane v2 including specifying priority parameter as part of job params when submitting a job
* Removed container creation logic when retrieving linked storage account from the service

1.0.0b11
+++++++++++++++
* Remove `__import__('pkg_resources').declare_namespace(__name__)` to fix the namespace package issue.
Expand Down
17 changes: 17 additions & 0 deletions src/quantum/azext_quantum/_breaking_change.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from azure.cli.core.breaking_change import register_argument_deprecate

register_argument_deprecate('quantum execute', '--location', target_version="May 2026")
register_argument_deprecate('quantum run', '--location', target_version="May 2026")
register_argument_deprecate('quantum job submit', '--location', target_version="May 2026")
register_argument_deprecate('quantum job cancel', '--location', target_version="May 2026")
register_argument_deprecate('quantum job list', '--location', target_version="May 2026")
register_argument_deprecate('quantum job output', '--location', target_version="May 2026")
register_argument_deprecate('quantum job show', '--location', target_version="May 2026")
register_argument_deprecate('quantum job wait', '--location', target_version="May 2026")
register_argument_deprecate('quantum target list', '--location', target_version="May 2026")
register_argument_deprecate('quantum workspace set', '--location', target_version="May 2026")
register_argument_deprecate('quantum workspace quotas', '--location', target_version="May 2026")
29 changes: 17 additions & 12 deletions src/quantum/azext_quantum/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import os
from ._location_helper import normalize_location
from .__init__ import CLI_REPORTED_VERSION
from .vendored_sdks.azure_quantum_python._client import WorkspaceClient
from .vendored_sdks.azure_mgmt_quantum import AzureQuantumManagementClient


def is_env(name):
Expand Down Expand Up @@ -38,9 +40,8 @@ def get_appid():

# Control Plane clients

def cf_quantum_mgmt(cli_ctx, *_):
def cf_quantum_mgmt(cli_ctx, *_) -> AzureQuantumManagementClient:
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from .vendored_sdks.azure_mgmt_quantum import AzureQuantumManagementClient
client = get_mgmt_service_client(cli_ctx, AzureQuantumManagementClient, base_url_bound=False)
# Add user agent on the management client to include extension information
client._config.user_agent_policy.add_user_agent(get_appid())
Expand All @@ -61,22 +62,26 @@ def cf_offerings(cli_ctx, *_):

# Data Plane clients

def cf_quantum(cli_ctx, subscription_id=None, location=None):
from .vendored_sdks.azure_quantum import ServicesClient
creds = _get_data_credentials(cli_ctx, subscription_id)
return ServicesClient(location, creds)
def cf_quantum(cli_ctx, subscription: str, resource_group: str, ws_name: str, endpoint: str | None) -> WorkspaceClient:
creds = _get_data_credentials(cli_ctx, subscription)
if not endpoint:
client = cf_workspaces(cli_ctx)
ws = client.get(resource_group, ws_name)
endpoint = ws.properties.endpoint_uri
ws_cl = WorkspaceClient(endpoint, creds)
return ws_cl


def cf_providers(cli_ctx, subscription_id=None, location=None):
return cf_quantum(cli_ctx, subscription_id, location).providers
def cf_providers(cli_ctx, subscription: str, resource_group: str, ws_name: str, endpoint: str | None):
return cf_quantum(cli_ctx, subscription, resource_group, ws_name, endpoint).services.providers


def cf_jobs(cli_ctx, subscription_id=None, location=None):
return cf_quantum(cli_ctx, subscription_id, location).jobs
def cf_jobs(cli_ctx, subscription: str, resource_group: str, ws_name: str, endpoint: str | None):
return cf_quantum(cli_ctx, subscription, resource_group, ws_name, endpoint).services.jobs


def cf_quotas(cli_ctx, subscription_id=None, location=None):
return cf_quantum(cli_ctx, subscription_id, location).quotas
def cf_quotas(cli_ctx, subscription: str, resource_group: str, ws_name: str, endpoint: str | None):
return cf_quantum(cli_ctx, subscription, resource_group, ws_name, endpoint).services.quotas


# Helper clients
Expand Down
23 changes: 3 additions & 20 deletions src/quantum/azext_quantum/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,20 @@
from .operations.target import TargetInfo


def validate_workspace_internal(cmd, namespace, require_location):
def validate_workspace_info(cmd, namespace):
"""
Internal implementation to validate workspace info parameters with an optional location
Makes sure all parameters for a workspace are available.
"""
group = getattr(namespace, 'resource_group_name', None)
name = getattr(namespace, 'workspace_name', None)
location = getattr(namespace, 'location', None)
ws = WorkspaceInfo(cmd, group, name, location)
ws = WorkspaceInfo(cmd, group, name)

if not ws.subscription:
raise ValueError("Missing subscription argument")
if not ws.resource_group:
raise ValueError("Missing resource-group argument")
if not ws.name:
raise ValueError("Missing workspace-name argument")
if require_location and not ws.location:
raise ValueError("Missing location argument")


def validate_workspace_info(cmd, namespace):
"""
Makes sure all parameters for a workspace are available including location.
"""
validate_workspace_internal(cmd, namespace, True)


def validate_workspace_info_no_location(cmd, namespace):
"""
Makes sure all parameters for a workspace are available, not including location.
"""
validate_workspace_internal(cmd, namespace, False)


def validate_target_info(cmd, namespace):
Expand Down
6 changes: 3 additions & 3 deletions src/quantum/azext_quantum/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from collections import OrderedDict
from azure.cli.core.commands import CliCommandType
from ._validators import validate_workspace_info, validate_target_info, validate_workspace_and_target_info, validate_workspace_info_no_location, validate_provider_and_sku_info
from ._validators import validate_workspace_info, validate_target_info, validate_workspace_and_target_info, validate_provider_and_sku_info

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -126,9 +126,9 @@ def load_command_table(self, _):

with self.command_group('quantum workspace', workspace_ops) as w:
w.command('create', 'create')
w.command('delete', 'delete', validator=validate_workspace_info_no_location)
w.command('delete', 'delete', validator=validate_workspace_info)
w.command('list', 'list')
w.show_command('show', validator=validate_workspace_info_no_location)
w.show_command('show', validator=validate_workspace_info)
w.command('set', 'set', validator=validate_workspace_info)
w.command('clear', 'clear')
w.command('quotas', 'quotas', validator=validate_workspace_info)
Expand Down
Loading
Loading