Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### 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]>
- Loading branch information