You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Qiskit Experiments version: current main (f859b2d)
Python version: 3.9
Operating system: Linux
What is the current behavior?
When you try to save the experiment data from a calibration experiment, it fails to save because most calibration experiments set a pulse schedule as an experiment option and that can not be serialized for storing in the database. Here is the output I see (see steps to reproduce for the code to generate this output):
Unable to save the experiment data: Traceback (most recent call last):
File "/home/wshanks/Documents/Coding/qiskit-experiments/qiskit_experiments/database_service/utils.py", line 152, in save_data
return True, new_func(**kwargs)
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/site-packages/qiskit/providers/ibmq/experiment/ibm_experiment_service.py", line 173, in create_experiment
response_data = self._api_client.experiment_upload(data)
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/site-packages/qiskit/providers/ibmq/api/clients/experiment.py", line 117, in experiment_upload
return self.base_api.experiment_upload(data)
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/site-packages/qiskit/providers/ibmq/api/rest/root.py", line 244, in experiment_upload
raw_data = self.session.post(url, json=experiment).json()
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/site-packages/requests/sessions.py", line 590, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/site-packages/qiskit/providers/ibmq/api/session.py", line 277, in request
response = super().request(method, final_url, headers=headers, **kwargs)
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/site-packages/requests/sessions.py", line 528, in request
prep = self.prepare_request(req)
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/site-packages/requests/sessions.py", line 456, in prepare_request
p.prepare(
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/site-packages/requests/models.py", line 319, in prepare
self.prepare_body(data, files, json)
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/site-packages/requests/models.py", line 471, in prepare_body
body = complexjson.dumps(json, allow_nan=False)
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/json/__init__.py", line 234, in dumps
return cls(
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type ScheduleBlock is not JSON serializable
Unable to save the experiment data: Traceback (most recent call last):
File "/home/wshanks/Documents/Coding/qiskit-experiments/qiskit_experiments/database_service/utils.py", line 152, in save_data
return True, new_func(**kwargs)
TypeError: create_analysis_result() missing 1 required positional argument: 'data'
Unable to save the experiment data: Traceback (most recent call last):
File "/home/wshanks/Documents/Coding/qiskit-experiments/qiskit_experiments/database_service/utils.py", line 152, in save_data
return True, new_func(**kwargs)
TypeError: create_analysis_result() missing 1 required positional argument: 'data'
Unable to save the experiment data: Traceback (most recent call last):
File "/home/wshanks/Documents/Coding/qiskit-experiments/qiskit_experiments/database_service/utils.py", line 152, in save_data
return True, new_func(**kwargs)
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/site-packages/qiskit/providers/ibmq/experiment/ibm_experiment_service.py", line 1065, in create_figure
response = self._api_client.experiment_plot_upload(experiment_id, figure, figure_name)
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/contextlib.py", line 135, in __exit__
self.gen.throw(type, value, traceback)
File "/home/wshanks/conda/envs/qiskit/lib/python3.9/site-packages/qiskit/providers/ibmq/experiment/utils.py", line 32, in map_api_error
raise IBMExperimentEntryNotFound(error_msg + f" {api_err}") from None
qiskit.providers.ibmq.experiment.exceptions.IBMExperimentEntryNotFound: 'Figure figure_7fa922a9_2021-09-30T16:34:05.546362_0.svg already exists. \'404 Client Error: Not Found for url: https://api.quantum-computing.ibm.com/resultsdb/experiments/7fa922a9-c499-4e65-b349-fd9509d62693/plots. {"errors":["Experiment 7fa922a9-c499-4e65-b349-fd9509d62693 does not exist"]}\''
The code does keep going without raising an exception which is good. However, it does print the following to stdout which is not true (the experiment is not accessible):
You can view the experiment online at https://quantum-computing.ibm.com/experiments/7fa922a9-c499-4e65-b349-fd9509d62693
The ideal solution would be if pulse schedules could be serialized so they could be stored in the database like other experiment options. That might not be a quick solution but is already planned (Qiskit/qiskit#6923).
More generally, should the experiment save as much data as possible to the results database and just drop fields that can't be serialized? Or should we insist on full serialization (which might be needed for future plans)? Outside of calibrations, this issue could come up again in the future for other options that users might attach that can't be serialized.
Suggested solutions
See discussion in expected behavior
The text was updated successfully, but these errors were encountered:
Perhaps a temporary option, which I think we also mentioned, is saving the schedule as a string? Also, this issues means that any transpiler/run/experiment option should be serializable (unless we drop options). Another option that comes to mind and will cause issues is the instruction schedule map since, as with this issue, schedules cannot yet be serialized. PassManagers also potential transpiler options may need to be serialized too (not sure if this is possible yet?).
Informations
What is the current behavior?
When you try to save the experiment data from a calibration experiment, it fails to save because most calibration experiments set a pulse schedule as an experiment option and that can not be serialized for storing in the database. Here is the output I see (see steps to reproduce for the code to generate this output):
The code does keep going without raising an exception which is good. However, it does print the following to stdout which is not true (the experiment is not accessible):
Steps to reproduce the problem
With whichever
backend
you prefer, run:What is the expected behavior?
The ideal solution would be if pulse schedules could be serialized so they could be stored in the database like other experiment options. That might not be a quick solution but is already planned (Qiskit/qiskit#6923).
More generally, should the experiment save as much data as possible to the results database and just drop fields that can't be serialized? Or should we insist on full serialization (which might be needed for future plans)? Outside of calibrations, this issue could come up again in the future for other options that users might attach that can't be serialized.
Suggested solutions
See discussion in expected behavior
The text was updated successfully, but these errors were encountered: