-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Make PrimitiveJob serializable #12963
base: main
Are you sure you want to change the base?
Conversation
One or more of the following people are relevant to this code:
|
Pull Request Test Coverage Report for Build 12402199227Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
It looks good overall. Could you add a reno to describe that both |
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.
LGTM. Could you ask someone else to review it too just in case?
…-terra into update-primitve-job
@@ -46,19 +48,30 @@ def _submit(self): | |||
self._future = executor.submit(self._function, *self._args, **self._kwargs) | |||
executor.shutdown(wait=False) | |||
|
|||
def _prepare_dump(self): |
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 recall that this method is used when we serialize a job. But, this method is not used any other methods of this class. So, it might be good to add a comment just in case though it is a private method.
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.
Added in fac959a
Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
releasenotes/notes/serialize-primitive-job-aa97d0bf8221ea99.yaml
Outdated
Show resolved
Hide resolved
Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
Summary
In
qiskit-ibm-runtime
we want to add job methods to ourQiskitRuntimeLocalService
(Issue Qiskit/qiskit-ibm-runtime#1607). In order to savePrimitiveJob
objects locally we need a way to serialize them. It's currently not serializable due to the use ofThreadPoolExecutor
:qiskit/qiskit/primitives/primitive_job.py
Lines 47 to 48 in 35d0954
Credit to @t-imamichi
Details and comments
Also fixes #12787