Skip to content

Commit fa48ca2

Browse files
kt474ptristan3
andauthored
Deprecate RuntimeJob (#2170)
* Deprecate RuntimeJob * Add release note * update docs --------- Co-authored-by: ptristan3 <[email protected]>
1 parent 50fac49 commit fa48ca2

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

qiskit_ibm_runtime/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@
152152
153153
When you use the ``run()`` method of the :class:`Sampler` or :class:`Estimator`
154154
to invoke the primitive, a
155-
:class:`RuntimeJob` instance is returned. This class has all the basic job
156-
methods, such as :meth:`RuntimeJob.status`, :meth:`RuntimeJob.result`, and
157-
:meth:`RuntimeJob.cancel`.
155+
:class:`RuntimeJobV2` instance is returned. This class has all the basic job
156+
methods, such as :meth:`RuntimeJobV2.status`, :meth:`RuntimeJobV2.result`, and
157+
:meth:`RuntimeJobV2.cancel`.
158158
159159
Logging
160160
-------

qiskit_ibm_runtime/qiskit_runtime_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ def _run(
794794
start_session: Set to True to explicitly start a runtime session. Defaults to False.
795795
796796
Returns:
797-
A ``RuntimeJob`` instance representing the execution.
797+
A ``RuntimeJobV2`` instance representing the execution.
798798
799799
Raises:
800800
IBMInputValueError: If input is invalid.

qiskit_ibm_runtime/runtime_job.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
)
3636
from .utils.result_decoder import ResultDecoder
3737
from .utils.queueinfo import QueueInfo
38+
from .utils.deprecation import issue_deprecation_msg
3839
from .api.clients import RuntimeClient
3940
from .api.exceptions import RequestsApiError
4041
from .api.client_parameters import ClientParameters
@@ -95,7 +96,7 @@ def __init__(
9596
tags: Optional[List] = None,
9697
version: Optional[int] = None,
9798
) -> None:
98-
"""RuntimeJob constructor.
99+
"""(DEPRECATED) RuntimeJob constructor.
99100
100101
Args:
101102
backend: The backend instance used to run this job.
@@ -112,6 +113,15 @@ def __init__(
112113
tags: Tags assigned to the job.
113114
version: Primitive version.
114115
"""
116+
117+
issue_deprecation_msg(
118+
msg="The RuntimeJob class is deprecated",
119+
version="0.38.0",
120+
stacklevel=4,
121+
remedy="All primitives now return the RuntimeJobV2 class. The major difference between "
122+
"the two classes is that `Job.status()` is returned as a string in RuntimeJobV2.",
123+
)
124+
115125
Job.__init__(self, backend=backend, job_id=job_id)
116126
BaseRuntimeJob.__init__(
117127
self,
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:class:`RuntimeJob` is now deprecated. All of the primitives return :class:`RuntimeJobV2` so there is no need for
2+
``RuntimeJob`` anymore. The major difference between the two classes is that
3+
:meth:`~.RuntimeJobV2.status` returns a string instead of Qiskit's ``JobStatus`` enum.

0 commit comments

Comments
 (0)