-
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
Construct subclasses of InstructionDurations
from backend
#11501
Conversation
One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 7427911562
💛 - Coveralls |
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.
This seems straightforwards and safe, thanks. This class doesn't look to have been designed for subclassing (there's no contract for when it will call its own methods, so it's fragile to depend on), but it's a simple mostly-data class, so it's probably not too risky if others are subclassing it.
Can you add a one-line bugfix release note mentioning the change?
Actually, using the right constructor now causes an error on qiskit-ibm-provider, but I'll open an issue there 😄 |
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 seems weird, unless InstructionDurations.from_backend
is already broken for IBMBackend
(which it could well be - I'm pretty sure from_backend
assumes a BackendV1
and has never been updated). I'm fine for this PR update the call here, because really, it's pretty rare for constructors to be safe for virtual override - much like __init__
is near-always necessarily overridden by subclasses, I'd expect all other constructors to be as well.
…1501) * Construct InstructionDuration subclass * add reno * Add Sphinx cross-refs --------- Co-authored-by: Jake Lishman <[email protected]>
@Mergifyio backport stable/0.46 |
✅ Backports have been created
|
* Construct InstructionDuration subclass * add reno * Add Sphinx cross-refs --------- Co-authored-by: Jake Lishman <[email protected]> (cherry picked from commit fbb0938)
…11727) * Construct InstructionDuration subclass * add reno * Add Sphinx cross-refs --------- Co-authored-by: Jake Lishman <[email protected]> (cherry picked from commit fbb0938) Co-authored-by: Diego Ristè <[email protected]>
Summary
Modify construction of
InstructionDurations.from_backend
to return an instance of any subclass, as in the use model for dynamic circuits on qiskit-ibm-providerDetails and comments
In the current behavior
DynamicInstructionDurations.from_backend()
(a subclass ofInstructionDurations
) returns an instance ofInstructionDurations
(and corresponding durations) instead.