Skip to content

Commit 6a732f4

Browse files
gadialyaelbh
andauthored
Experiment data fixes (#1092)
### Summary This PR handles some issues related to `ExperimentData` 1. Fixing a bug in `_add_job_data`. 2. Adding multi-upload capability to `ExperimentData.save()` 3. Different `provider` handling to enable better data loading 4. `start_datetime` and `end_datetime` are not being set at all, and `creation_datetime` and `updated_datetime` are being set only after loading the experiment from the server. ### Details and comments 1. Currently `_add_job_data` is adding the result of a job without explicitly supplying its `job_id`. While in the old `qiskit-ibmq-provider` it was ok, in the new `qiskit-ibm-provider` it seems the job id contained in the `Result` object is different than the job id of the actual job itself. Since `ExperimentData` keeps the original job id, the result is that for every submitted job, it ends up with two different ids: One of a seemingly unfinished job, and the second for a job which was seemingly never initiated. This PR addresses this issue by using the original job id whenever possible. 2. `ExperimentData.save()` currently uploads both analysis results and figures one-by-one, with the result being inefficient which already affects other projects. This issue is handled in `qiskit-ibm-experiments` whose API was enlarged to allow multiple uploading of analysis results and figures; this PR enables this API usage in `ExperimentData` 3. `ExperimentData.load()` currently takes the `experiment_id` and an `IBMExperimentService` object. This has two setbacks: First, `IBMExperimentService` should be transparent to the users as much as possible. Second, `IBMExperimentService` handles the resultDB data, but the job data stored by `ExperimentData` is handled by the `IBMProvider`. This issue can be fixed by allowing the provider to be passed as parameter to `load()` since the service can be obtained from the provider. This change also fixes #1093. 4. `start_datetime` and `end_datetime` were not set by `ExperimentData` nor by the database itself. This PR makes the experiment data set `start_datetime` to the time it was created (unless another value is passed on creation; currently the `BaseExperiment` creates the experiment data right before beginning the experiment. Also, this PR makes every job update the `end_datetime` once it terminates. Along with that, calls to `save()` now update the values of `creation_datetime` and `updated_datetime` (which are set by the server). All the times are stored in UTC timezone, but the getters return them in local time, and the setters convert from local time to UTC. 5. `ExperimentData.save()` did not raise error in case no database service was available. Now it raises an error if `suppress_errors` is `False`. --------- Co-authored-by: Yael Ben-Haim <[email protected]>
1 parent a8f9de8 commit 6a732f4

File tree

5 files changed

+273
-74
lines changed

5 files changed

+273
-74
lines changed

qiskit_experiments/database_service/exceptions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ class ExperimentEntryExists(ExperimentDataError):
3131
"""Errors raised when an experiment entry already exists."""
3232

3333
pass
34+
35+
36+
class ExperimentDataSaveFailed(ExperimentDataError):
37+
"""Errors raised when an experiment save fails."""
38+
39+
pass

0 commit comments

Comments
 (0)