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

Add BasePrimitiveJob class and deprecate PrimitiveJob.submit method #11552

Merged
merged 4 commits into from
Jan 16, 2024

Conversation

t-imamichi
Copy link
Member

@t-imamichi t-imamichi commented Jan 12, 2024

Summary

Add BasePrimitiveJob class and deprecate PrimitiveJob.submit method

Resolves #11541

TODO

  • reno

Details and comments

@t-imamichi t-imamichi requested review from a team as code owners January 12, 2024 14:25
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

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

@coveralls
Copy link

coveralls commented Jan 12, 2024

Pull Request Test Coverage Report for Build 7537622138

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 89.352%

Totals Coverage Status
Change from base Build 7508541254: 0.01%
Covered Lines: 59540
Relevant Lines: 66635

💛 - Coveralls

@ihincks ihincks added the mod: primitives Related to the Primitives module label Jan 12, 2024
@ihincks ihincks added this to the 1.0.0 milestone Jan 12, 2024
@jyu00
Copy link
Contributor

jyu00 commented Jan 12, 2024

I think the other JobV1 methods need to also go into BasePrimitiveJob.

Essentially BasePrimitiveJob would look exactly like JobV1 except

  • no more submit()
  • no more backend()
  • __init__ doesn't take backend
  • status() returns a generic Status and result() returns a generic Result()

@ihincks
Copy link
Contributor

ihincks commented Jan 12, 2024

Since Status is now generic, I guess it makes sense to expose done(), cancelled(), running(), etc as abstract methods so that this information can be had without knowing too much about the status object, which is what @jyu00 is also suggesting. I do wonder if we should deprecate wait_for_final_state() in addition to submit() since it seems a bit like bloat---I usually see people just calling result() when they want to block.

@t-imamichi
Copy link
Member Author

I copied all JobV1 methods except submit and wait_for_final_state.

This was referenced Jan 15, 2024
qiskit/primitives/base/base_primitive_job.py Outdated Show resolved Hide resolved
qiskit/primitives/primitive_job.py Outdated Show resolved Hide resolved
qiskit/primitives/primitive_job.py Outdated Show resolved Hide resolved
qiskit/primitives/base/base_primitive_job.py Outdated Show resolved Hide resolved
@ihincks
Copy link
Contributor

ihincks commented Jan 15, 2024

I left some relatively minor comments. Other than those, this LGTM.

Also, I should clarify that I'm not strongly against keeping wait_for_final_state, it just seems like an obvious (to me) place to reduce clutter.

Co-authored-by: Ian Hincks <ian.hincks@gmail.com>
@t-imamichi
Copy link
Member Author

I agree with your idea to deprecate wait_for_final_state. If there is no objection, how about deprecating it?

@ihincks
Copy link
Contributor

ihincks commented Jan 16, 2024

@jyu00 may still want to review.

Edit: @jyu00 said I can go ahead with merge.

@ihincks ihincks added this pull request to the merge queue Jan 16, 2024
Merged via the queue into Qiskit:main with commit 1f8a40f Jan 16, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod: primitives Related to the Primitives module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PrimitiveJob should stop inheriting from JobV1
5 participants