QbraidJob.result() drops the finished circuits' results of a FAILED batch job

Open Beginner friendly
#1,557 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start in qbraid/runtime/native/job.py at QbraidJob.result() and compare its handling of COMPLETED jobs with the FAILED batch behavior described for app/routers/jobs_result.py. Verify that a failed batch with available results returns per-circuit results, while a failed result fetch falls back to empty results; BatchResult.success should remain false.

Written by the indexing model from the issue text.

Description

enhancement ✨ results 📋

QbraidJob.result() only downloads results when the job is COMPLETED. A batch job that ends FAILED because some of its circuits failed gets results=[empty] * num_circuits, so the counts of the circuits that did finish are lost. Those circuits are charged.

The platform does serve them. runtime-api returns the stored BatchResult for a FAILED batch (app/routers/jobs_result.py: has_results = job.status == COMPLETED or (is_batch and job.status == FAILED)), with each circuit's own status, counts or statusMsg. qBraid's simulator batches already settle like this, e.g. 2 of 3 circuits completed: FAILED, completedCircuits: 2, cost charged for the 2.

Affected: qbraid==0.13.0 and main (qbraid/runtime/native/job.py, QbraidJob.result).

Fix: for a batch job (numCircuits > 1) that ended FAILED, call get_job_result and build per-circuit results from it, falling back to the empty results only if that call fails. BatchResult.success can stay False.

Dominant language
Python
Stars
117
Forks
66
Avg merge
1d 10h
Merged PRs (30d)
22

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from qBraid/qBraid

All issues in qBraid/qBraid

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.