Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into guyi/AddPagination
Browse files Browse the repository at this point in the history
  • Loading branch information
Yi Gu committed Feb 6, 2025
2 parents d89d06c + 0348a87 commit 16c907e
Show file tree
Hide file tree
Showing 112 changed files with 10,123 additions and 61,559 deletions.
2 changes: 1 addition & 1 deletion .ado/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
displayName: Set Python version

- script: |
pip install pytest pytest-azurepipelines pytest-cov
pip install pytest pytest-azurepipelines pytest-cov pytest-regressions
displayName: Install pytest dependencies
- script: |
Expand Down
2 changes: 1 addition & 1 deletion .ado/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ extends:
displayName: Set Python version

- script: |
pip install pytest pytest-azurepipelines pytest-cov
pip install pytest pytest-azurepipelines pytest-cov pytest-regressions
displayName: Install pytest dependencies
- script: |
Expand Down
2 changes: 1 addition & 1 deletion azure-quantum/azure/quantum/argument_types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License.
##

"""Defines argument types for Microsoft Estimator"""
"""Defines argument types for QIR"""

from .types import EmptyArray, Pauli, Range, Result

Expand Down
5 changes: 0 additions & 5 deletions azure-quantum/azure/quantum/qiskit/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@
QCIQPUBackend,
)

from azure.quantum.qiskit.backends.microsoft import (
MicrosoftBackend,
MicrosoftResourceEstimationBackend,
)

from .backend import AzureBackendBase

__all__ = [
Expand Down
149 changes: 0 additions & 149 deletions azure-quantum/azure/quantum/qiskit/backends/microsoft.py

This file was deleted.

7 changes: 1 addition & 6 deletions azure-quantum/azure/quantum/qiskit/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import json
import re
from azure.quantum import Job
from azure.quantum.qiskit.results.resource_estimator import make_estimator_result

import logging
logger = logging.getLogger(__name__)
Expand All @@ -38,7 +37,6 @@
MICROSOFT_OUTPUT_DATA_FORMAT_V2 = "microsoft.quantum-results.v2"
IONQ_OUTPUT_DATA_FORMAT = "ionq.quantum-results.v1"
QUANTINUUM_OUTPUT_DATA_FORMAT = "honeywell.quantum-results.v1"
RESOURCE_ESTIMATOR_OUTPUT_DATA_FORMAT = "microsoft.resource-estimates.v1"

class AzureQuantumJob(JobV1):
def __init__(
Expand Down Expand Up @@ -96,10 +94,7 @@ def result(self, timeout=None, sampler_seed=None):
"error_data" : None if self._azure_job.details.error_data is None else self._azure_job.details.error_data.as_dict()
}

if self._azure_job.details.output_data_format == RESOURCE_ESTIMATOR_OUTPUT_DATA_FORMAT:
return make_estimator_result(result_dict)
else:
return Result.from_dict(result_dict)
return Result.from_dict(result_dict)

def cancel(self):
"""Attempt to cancel the job."""
Expand Down
Empty file.
25 changes: 0 additions & 25 deletions azure-quantum/azure/quantum/qiskit/results/resource_estimator.py

This file was deleted.

15 changes: 0 additions & 15 deletions azure-quantum/azure/quantum/target/microsoft/__init__.py

This file was deleted.

110 changes: 108 additions & 2 deletions azure-quantum/azure/quantum/target/microsoft/elements/dft/job.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import collections.abc
from typing import Any, Dict, Union
import logging
from typing import Any, Dict, Union, Optional
from azure.quantum.job import JobFailedWithResultsError
from azure.quantum.job.base_job import BaseJob, ContentType
from azure.quantum.job.job import Job, DEFAULT_TIMEOUT
from azure.quantum._client.models import JobDetails
from azure.quantum.workspace import Workspace

logger = logging.getLogger(__name__)

class MicrosoftElementsDftJob(Job):
"""
Expand Down Expand Up @@ -62,4 +67,105 @@ def _is_dft_failure_results(failure_results: Union[Dict[str, Any], str]) -> bool
and "error" in failure_results["results"][0] \
and isinstance(failure_results["results"][0]["error"], dict) \
and "error_type" in failure_results["results"][0]["error"] \
and "error_message" in failure_results["results"][0]["error"]
and "error_message" in failure_results["results"][0]["error"]

@classmethod
def from_input_data_container(
cls,
workspace: "Workspace",
name: str,
target: str,
input_data: bytes,
batch_input_blobs: Dict[str, bytes],
content_type: ContentType = ContentType.json,
blob_name: str = "inputData",
encoding: str = "",
job_id: str = None,
container_name: str = None,
provider_id: str = None,
input_data_format: str = None,
output_data_format: str = None,
input_params: Dict[str, Any] = None,
session_id: Optional[str] = None,
**kwargs
) -> "BaseJob":
"""Create a new Azure Quantum job based on a list of input_data.
:param workspace: Azure Quantum workspace to submit the input_data to
:type workspace: Workspace
:param name: Name of the job
:type name: str
:param target: Azure Quantum target
:type target: str
:param input_data: Raw input data to submit
:type input_data: Dict
:param blob_name: Dict of Input data json to gives a table of contents
:type batch_input_blobs: Dict
:param blob_name: Dict of QcSchema Data where the key is the blob name to store it in the container
:type blob_name: str
:param content_type: Content type, e.g. "application/json"
:type content_type: ContentType
:param encoding: input_data encoding, e.g. "gzip", defaults to empty string
:type encoding: str
:param job_id: Job ID, defaults to None
:type job_id: str
:param container_name: Container name, defaults to None
:type container_name: str
:param provider_id: Provider ID, defaults to None
:type provider_id: str
:param input_data_format: Input data format, defaults to None
:type input_data_format: str
:param output_data_format: Output data format, defaults to None
:type output_data_format: str
:param input_params: Input parameters, defaults to None
:type input_params: Dict[str, Any]
:param input_params: Input params for job
:type input_params: Dict[str, Any]
:return: Azure Quantum Job
:rtype: Job
"""
# Generate job ID if not specified
if job_id is None:
job_id = cls.create_job_id()

# Create container if it does not yet exist
container_uri = workspace.get_container_uri(
job_id=job_id,
container_name=container_name
)
logger.debug(f"Container URI: {container_uri}")

# Upload Input Data
input_data_uri = cls.upload_input_data(
container_uri=container_uri,
input_data=input_data,
content_type=content_type,
blob_name=blob_name,
encoding=encoding,
)

# Upload data to container
for blob_name, input_data_item in batch_input_blobs.items():
cls.upload_input_data(
container_uri=container_uri,
input_data=input_data_item,
content_type=content_type,
blob_name=blob_name,
encoding=encoding,
)

# Create and submit job
return cls.from_storage_uri(
workspace=workspace,
job_id=job_id,
target=target,
input_data_uri=input_data_uri,
container_uri=container_uri,
name=name,
input_data_format=input_data_format,
output_data_format=output_data_format,
provider_id=provider_id,
input_params=input_params,
session_id=session_id,
**kwargs
)
Loading

0 comments on commit 16c907e

Please sign in to comment.