From 71270df525c5f15db2b48deff1af7df85465e1e3 Mon Sep 17 00:00:00 2001 From: kevin-tian Date: Mon, 3 Mar 2025 16:19:22 -0500 Subject: [PATCH 1/2] Deprecate RuntimeJob --- qiskit_ibm_runtime/runtime_job.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/qiskit_ibm_runtime/runtime_job.py b/qiskit_ibm_runtime/runtime_job.py index fb86b3d2c..8d13b1480 100644 --- a/qiskit_ibm_runtime/runtime_job.py +++ b/qiskit_ibm_runtime/runtime_job.py @@ -35,6 +35,7 @@ ) from .utils.result_decoder import ResultDecoder from .utils.queueinfo import QueueInfo +from .utils.deprecation import issue_deprecation_msg from .api.clients import RuntimeClient from .api.exceptions import RequestsApiError from .api.client_parameters import ClientParameters @@ -95,7 +96,7 @@ def __init__( tags: Optional[List] = None, version: Optional[int] = None, ) -> None: - """RuntimeJob constructor. + """(DEPRECATED) RuntimeJob constructor. Args: backend: The backend instance used to run this job. @@ -112,6 +113,15 @@ def __init__( tags: Tags assigned to the job. version: Primitive version. """ + + issue_deprecation_msg( + msg="The RuntimeJob class is deprecated", + version="0.37.0", + stacklevel=4, + remedy="All primitives now return the RuntimeJobV2 class. The major difference between " + "the two classes is that `Job.status()` is returned as a string in RuntimeJobV2.", + ) + Job.__init__(self, backend=backend, job_id=job_id) BaseRuntimeJob.__init__( self, From cfcd0197f4257fd02569713172bc01506abe7a3c Mon Sep 17 00:00:00 2001 From: kevin-tian Date: Mon, 3 Mar 2025 16:25:39 -0500 Subject: [PATCH 2/2] Add release note --- release-notes/unreleased/2170.deprecation.rst | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 release-notes/unreleased/2170.deprecation.rst diff --git a/release-notes/unreleased/2170.deprecation.rst b/release-notes/unreleased/2170.deprecation.rst new file mode 100644 index 000000000..7a07a351b --- /dev/null +++ b/release-notes/unreleased/2170.deprecation.rst @@ -0,0 +1,3 @@ +:class:`RuntimeJob` is now deprecated. All of the primitives return :class:`RuntimeJobV2` so there is no need for +``RuntimeJob`` anymore. The major difference between the two classes is that +:meth:`~.RuntimeJobV2.status` returns a string instead of Qiskit's ``JobStatus`` enum. \ No newline at end of file