Skip to content

Commit

Permalink
updated from PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ptristan3 committed Apr 8, 2024
1 parent 9110b8d commit be879af
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
12 changes: 11 additions & 1 deletion qiskit_ibm_runtime/base_primitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from .runtime_job_v2 import RuntimeJobV2
from .ibm_backend import IBMBackend
from .utils.default_session import get_cm_session
from .utils.deprecation import issue_deprecation_msg
from .utils.deprecation import issue_deprecation_msg, deprecate_function
from .utils.utils import validate_isa_circuits, is_simulator
from .constants import DEFAULT_DECODERS
from .qiskit_runtime_service import QiskitRuntimeService
Expand Down Expand Up @@ -178,6 +178,16 @@ def _run(self, pubs: Union[list[EstimatorPub], list[SamplerPub]]) -> RuntimeJobV
inputs=primitive_inputs,
)

@property
def session(self) -> Optional[Session]:
"""Return mode used by this primitive.
Returns:
Mode used by this primitive, or ``None`` if session is not used.
"""
deprecate_function("session", "0.23.0", "Please use the 'mode' property instead.")
return self._mode

@property
def mode(self) -> Optional[Session | Batch | str]:
"""Return the execution mode used by this primitive.
Expand Down
7 changes: 4 additions & 3 deletions qiskit_ibm_runtime/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,14 @@ def __init__(
"""Initializes the Estimator primitive.
Args:
mode: The execution mode used to make the primitive query. It can be
mode: The execution mode used to make the primitive query. It can be:
* A :class:`Backend` if you are using job mode.
* A :class:`Session` if you are using session execution mode.
* A :class:`Batch` if you are using batch execution mode.
Refer to the `Qiskit Runtime documentation <https://docs.quantum.ibm.com/run>`_.
for more information about the ``Execution modes``.
Refer to the `Qiskit Runtime documentation <https://docs.quantum.ibm.com/run>`_.
for more information about the ``Execution modes``.
backend: Backend to run the primitive. This can be a backend name or an :class:`IBMBackend`
instance. If a name is specified, the default account (e.g. ``QiskitRuntimeService()``)
Expand Down
8 changes: 5 additions & 3 deletions qiskit_ibm_runtime/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,22 @@ def __init__(
"""Initializes the Sampler primitive.
Args:
mode: The execution mode used to make the primitive query. It can be
mode: The execution mode used to make the primitive query. It can be:
* A :class:`Backend` if you are using job mode.
* A :class:`Session` if you are using session execution mode.
* A :class:`Batch` if you are using batch execution mode.
Refer to the `Qiskit Runtime documentation <https://docs.quantum.ibm.com/run>`_.
for more information about the ``Execution modes``.
Refer to the `Qiskit Runtime documentation <https://docs.quantum.ibm.com/run>`_.
for more information about the ``Execution modes``.
backend: Backend to run the primitive. This can be a backend name or an :class:`IBMBackend`
instance. If a name is specified, the default account (e.g. ``QiskitRuntimeService()``)
is used.
session: Session in which to call the primitive.
If both ``session`` and ``backend`` are specified, ``session`` takes precedence.
If neither is specified, and the primitive is created inside a
:class:`qiskit_ibm_runtime.Session` context manager, then the session is used.
Otherwise if IBM Cloud channel is used, a default backend is selected.
Expand Down

0 comments on commit be879af

Please sign in to comment.