From 936a5e621a82938c837467601f69b0c184fd8b83 Mon Sep 17 00:00:00 2001 From: Kevin Tian Date: Mon, 23 Sep 2024 13:15:51 -0400 Subject: [PATCH] Deprecate returning JobStatus in RuntimeJob (#1933) * Deprecate returning JobStatus in RuntimeJob * Add release note --------- Co-authored-by: ptristan3 <44805021+ptristan3@users.noreply.github.com> --- qiskit_ibm_runtime/runtime_job.py | 12 +++++++++++- release-notes/unreleased/1933.deprecation.rst | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 release-notes/unreleased/1933.deprecation.rst diff --git a/qiskit_ibm_runtime/runtime_job.py b/qiskit_ibm_runtime/runtime_job.py index 296315265..cdbb27864 100644 --- a/qiskit_ibm_runtime/runtime_job.py +++ b/qiskit_ibm_runtime/runtime_job.py @@ -16,6 +16,7 @@ from concurrent import futures import logging import time +import warnings from qiskit.providers.backend import Backend from qiskit.providers.jobstatus import JobStatus, JOB_FINAL_STATES @@ -34,7 +35,7 @@ ) from .utils.result_decoder import ResultDecoder from .utils.queueinfo import QueueInfo -from .utils.deprecation import deprecate_function +from .utils.deprecation import deprecate_function, issue_deprecation_msg from .api.clients import RuntimeClient from .api.exceptions import RequestsApiError from .api.client_parameters import ClientParameters @@ -190,6 +191,15 @@ def status(self) -> JobStatus: Returns: Status of this job. """ + warnings.warn( + ( + "In a future release of qiskit-ibm-runtime no sooner than 3 months " + "after the release date of 0.30.0, RuntimeJob.status() will be returned as a string " + "instead of an instance of `JobStatus`." + ), + DeprecationWarning, + stacklevel=2, + ) self._set_status_and_error_message() return self._status diff --git a/release-notes/unreleased/1933.deprecation.rst b/release-notes/unreleased/1933.deprecation.rst new file mode 100644 index 000000000..0cb674d03 --- /dev/null +++ b/release-notes/unreleased/1933.deprecation.rst @@ -0,0 +1,2 @@ +In a future release, ``RuntimeJob.status()`` will be returned as a string instead of +an instance of ``JobStatus``. \ No newline at end of file