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 |
jakelishman
left a comment
There was a problem hiding this comment.
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 😄 |
jakelishman
left a comment
There was a problem hiding this comment.
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 <jake.lishman@ibm.com>
|
@Mergifyio backport stable/0.46 |
✅ Backports have been createdDetails
|
* Construct InstructionDuration subclass * add reno * Add Sphinx cross-refs --------- Co-authored-by: Jake Lishman <jake.lishman@ibm.com> (cherry picked from commit fbb0938)
Summary
Modify construction of
InstructionDurations.from_backendto 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.