Skip to content

Commit 1b1ca3d

Browse files
authored
Bug fixes for e2e tests (#739)
* Switch to 1e-2 in qiskit job's draw random sample to normilize probabilities rather than raising an error * Surface error when getting job results in cirq run * Remove not needed comments
1 parent ded0cf2 commit 1b1ca3d

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

azure-quantum/azure/quantum/cirq/service.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -259,17 +259,13 @@ def run(
259259
target_obj = self.get_target(name=target)
260260

261261
# For SDK Cirq job wrappers, Job.results() already returns a Cirq result.
262-
try:
263-
from azure.quantum.cirq.job import Job as CirqJob
264-
265-
if isinstance(job, CirqJob):
266-
return job.results(
267-
timeout_seconds=timeout_seconds,
268-
param_resolver=param_resolver,
269-
seed=seed,
270-
)
271-
except Exception:
272-
pass
262+
from azure.quantum.cirq.job import Job as CirqJob
263+
if isinstance(job, CirqJob):
264+
return job.results(
265+
timeout_seconds=timeout_seconds,
266+
param_resolver=param_resolver,
267+
seed=seed,
268+
)
273269

274270
# Otherwise, preserve provider-specific behavior (e.g., cirq_ionq.Job).
275271
try:

azure-quantum/azure/quantum/qiskit/job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def _format_results(
195195
def _draw_random_sample(self, sampler_seed, probabilities, shots):
196196
_norm = sum(probabilities.values())
197197
if _norm != 1:
198-
if np.isclose(_norm, 1.0, rtol=1e-4):
198+
if np.isclose(_norm, 1.0, atol=1e-2):
199199
probabilities = {k: v / _norm for k, v in probabilities.items()}
200200
else:
201201
raise ValueError(f"Probabilities do not add up to 1: {probabilities}")

0 commit comments

Comments
 (0)