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

Improve error message when trying to save a failed analysis #447

Closed
yaelbh opened this issue Oct 21, 2021 · 2 comments
Closed

Improve error message when trying to save a failed analysis #447

yaelbh opened this issue Oct 21, 2021 · 2 comments

Comments

@yaelbh
Copy link
Collaborator

yaelbh commented Oct 21, 2021

I wrote a script with a T1 experiment that has no chance to succeed:

from qiskit import IBMQ
from qiskit_experiments.library import T1

provider = IBMQ.load_account()
device = provider.backend.ibmq_belem

delays = list(range(5))
exp = T1(0, delays, unit='us')

res = exp.run(device, shots=1)
res.block_for_results()
res.save()

Analysis expectedly failed. I don't remember whether, in such a case of failing analysis, we expect a crash or a creation of an analysis object that contains information about the failure. I'm also not sure which of these two options actually happened. What I'm sure of is that save failed with an error message that's not clear enough for the user:

/home/hrlquantum/miniconda3/envs/env1/lib/python3.9/site-packages/scipy/optimize/minpack.py:828: OptimizeWarning: Covariance of the parameters could not be estimated
  warnings.warn('Covariance of the parameters could not be estimated',
Unable to save the experiment data: Traceback (most recent call last):
  File "/home/hrlquantum/work/experiments/ErrSave/qiskit_experiments/database_service/utils.py", line 174, in save_data
    return True, new_func(**kwargs)
  File "/home/hrlquantum/miniconda3/envs/env1/lib/python3.9/site-packages/qiskit/providers/ibmq/experiment/ibm_experiment_service.py", line 644, in create_analysis_result
    response = self._api_client.analysis_result_upload(
  File "/home/hrlquantum/miniconda3/envs/env1/lib/python3.9/contextlib.py", line 135, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/hrlquantum/miniconda3/envs/env1/lib/python3.9/site-packages/qiskit/providers/ibmq/experiment/utils.py", line 33, in map_api_error
    raise IBMQApiError(f"Failed to process the request: {api_err}") from None
qiskit.providers.ibmq.exceptions.IBMQApiError: 'Failed to process the request: \'400 Client Error: Bad Request for url: https://api.quantum-computing.ibm.com/resultsdb/analysis_results. {"errors":["Unexpected token I in JSON at position 274"]}\''

You can view the experiment online at https://quantum-computing.ibm.com/experiments/b7297813-0a6d-415e-9dcd-ad32d4277b55
@coruscating
Copy link
Collaborator

Have you tested this after #301 was merged? The error looks serialization related, which it would have fixed. Also, I ran your code on nairobi and didn't get an error: https://quantum-computing.ibm.com/experiments/7725e855-f737-44e4-88bf-4cf6a4ccb290

@yaelbh
Copy link
Collaborator Author

yaelbh commented Nov 29, 2021

Yes, it's fixed now

@yaelbh yaelbh closed this as completed Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants