Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QuantinuumJob response is sometimes JobStatus #29

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
23 changes: 23 additions & 0 deletions qiskit_quantinuum/quantinuumjob.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,29 @@ def _process_results(self):
results = []
self._status = JobStatus.DONE
for i, res_resp in enumerate(self._experiment_results):
if isinstance(res_resp, JobStatus):
self._status = res_resp

experiment_result = {
'shots': self._job_config.get('shots', 1),
'success': res_resp != JobStatus.ERROR,
'data': {'counts': {}},
'job_id': self._job_id
}

if self._circuits_job:
if len(self._experiments) <= i or self._experiments[i].metadata is None:
metadata = {}
else:
metadata = self._experiments[i].metadata
experiment_result['header'] = metadata
else:
experiment_result['header'] = self._qobj_payload[
'experiments'][i]['header'] if self._qobj_payload else {}
results.append(experiment_result)

continue

status = res_resp.get('status', 'failed')
if status == 'failed':
self._status = JobStatus.ERROR
Expand Down