Skip to content

Commit

Permalink
Use IBM-Provider-vendored pub/sub mechanism (#1328)
Browse files Browse the repository at this point in the history
This is being removed from Qiskit 1.0, and the IBM Provider is (until
deprecated) taking over brokering the IBM-Runtime-internal events.

Co-authored-by: Kevin Tian <[email protected]>
  • Loading branch information
jakelishman and kt474 authored Jan 22, 2024
1 parent 542ab18 commit 8723ccf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion qiskit_ibm_runtime/ibm_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

from qiskit import QuantumCircuit
from qiskit.qobj.utils import MeasLevel, MeasReturnType
from qiskit.tools.events.pubsub import Publisher

from qiskit.providers.backend import BackendV2 as Backend
from qiskit.providers.options import Options
Expand Down Expand Up @@ -67,6 +66,14 @@
)
from .utils.default_session import get_cm_session as get_cm_primitive_session

# If using a new-enough version of the IBM Provider, access the pub/sub
# mechanism from it as a broker, but fall back to Qiskit if we're using
# an old version (in which case it will also be falling back to Qiskit).
try:
from qiskit_ibm_provider.utils.pubsub import Publisher
except ImportError:
from qiskit.tools.events.pubsub import Publisher # pylint: disable=ungrouped-imports

logger = logging.getLogger(__name__)

QOBJRUNNERPROGRAMID = "circuit-runner"
Expand Down

0 comments on commit 8723ccf

Please sign in to comment.