-
Notifications
You must be signed in to change notification settings - Fork 131
Experiment data fixes #1092
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
Experiment data fixes #1092
Conversation
…object is not the same as the original job_id, which should be used here.
…riments into experiment_data_fixes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments for now, will review more closely when we decide on end_datetime
.
|
||
@staticmethod | ||
def get_service_from_backend(backend): | ||
def get_service_from_provider(provider): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should update the documentation that uses get_service_from_backend
if you're changing this interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'll keep both.
# if self._result_data or not self._backend: | ||
# return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's actually a nontrivial issue. _retrieve_data
is called from ExperimentData.load()
which first initializes a new object via the line expdata = cls(service=service, db_data=data, provider=provider)
and then calls expdata._retrieve_data()
. However, when initializing the expdata, the _result_data
field is also initialized to an empty thread safe dict, so it seems _retrieve_data
will never run. I don't see why this line is here.
Release notes are missing. |
…riments into experiment_data_fixes
Co-authored-by: Yael Ben-Haim <[email protected]>
Co-authored-by: Yael Ben-Haim <[email protected]>
Co-authored-by: Yael Ben-Haim <[email protected]>
Co-authored-by: Yael Ben-Haim <[email protected]>
…d of `None` to avoid failing exp save due to this missing field.
I ran a test experiment, but
Also, after loading the experiment data object from ResultsDB, the
|
You're not seeing
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the issues. There are a few remaining problems when running a composite experiment with flatten_results=False
:
- The child experiments don't have
end_datetime
s while the parent experiment does - Only one child experiment will have
updated_datetime
while the other child experiments and the parent don't
These should be addressed in a follow-up PR.
Summary
This PR handles some issues related to
ExperimentData
_add_job_data
.ExperimentData.save()
provider
handling to enable better data loadingstart_datetime
andend_datetime
are not being set at all, andcreation_datetime
andupdated_datetime
are being set only after loading the experiment from the server.Details and comments
Currently
_add_job_data
is adding the result of a job without explicitly supplying itsjob_id
. While in the oldqiskit-ibmq-provider
it was ok, in the newqiskit-ibm-provider
it seems the job id contained in theResult
object is different than the job id of the actual job itself. SinceExperimentData
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.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 inqiskit-ibm-experiments
whose API was enlarged to allow multiple uploading of analysis results and figures; this PR enables this API usage inExperimentData
ExperimentData.load()
currently takes theexperiment_id
and anIBMExperimentService
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 byExperimentData
is handled by theIBMProvider
. This issue can be fixed by allowing the provider to be passed as parameter toload()
since the service can be obtained from the provider. This change also fixesExperimentData
uses deprecatedbackend.retrieve_job
method #1093.start_datetime
andend_datetime
were not set byExperimentData
nor by the database itself. This PR makes the experiment data setstart_datetime
to the time it was created (unless another value is passed on creation; currently theBaseExperiment
creates the experiment data right before beginning the experiment. Also, this PR makes every job update theend_datetime
once it terminates. Along with that, calls tosave()
now update the values ofcreation_datetime
andupdated_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.ExperimentData.save()
did not raise error in case no database service was available. Now it raises an error ifsuppress_errors
isFalse
.