Skip to content
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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Conversation

kt474
Copy link
Member

@kt474 kt474 commented Aug 15, 2024

Summary

In qiskit-ibm-runtime we want to add job methods to our QiskitRuntimeLocalService (Issue Qiskit/qiskit-ibm-runtime#1607). In order to save PrimitiveJob objects locally we need a way to serialize them. It's currently not serializable due to the use of ThreadPoolExecutor:

executor = ThreadPoolExecutor(max_workers=1) # pylint: disable=consider-using-with
self._future = executor.submit(self._function, *self._args, **self._kwargs)

Credit to @t-imamichi

Details and comments

Also fixes #12787

@kt474 kt474 requested review from a team as code owners August 15, 2024 17:23
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core
  • @ajavadia
  • @levbishop
  • @t-imamichi

@coveralls
Copy link

coveralls commented Aug 15, 2024

Pull Request Test Coverage Report for Build 12912557410

Details

  • 14 of 20 (70.0%) changed or added relevant lines in 1 file are covered.
  • 14 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.01%) to 88.915%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/primitives/primitive_job.py 14 20 70.0%
Files with Coverage Reduction New Missed Lines %
crates/accelerate/src/unitary_synthesis.rs 1 92.97%
crates/qasm2/src/parse.rs 6 96.22%
crates/qasm2/src/lex.rs 7 91.73%
Totals Coverage Status
Change from base Build 12911792879: -0.01%
Covered Lines: 79422
Relevant Lines: 89324

💛 - Coveralls

@t-imamichi t-imamichi added mod: primitives Related to the Primitives module Changelog: New Feature Include in the "Added" section of the changelog labels Aug 16, 2024
@kt474 kt474 requested a review from t-imamichi December 5, 2024 16:14
@t-imamichi
Copy link
Member

It looks good overall. Could you add a reno to describe that both DataBin and PrimitiveJob become serializable?

t-imamichi
t-imamichi previously approved these changes Dec 11, 2024
Copy link
Member

@t-imamichi t-imamichi left a 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?

@t-imamichi t-imamichi requested a review from ihincks January 23, 2025 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog mod: primitives Related to the Primitives module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make DataBin pickle-able
5 participants