From af432b7b9176ed7f2b248c0e819b72fdfdf9feba Mon Sep 17 00:00:00 2001 From: Kevin Tian Date: Mon, 4 Dec 2023 10:10:09 -0500 Subject: [PATCH] Add job.properties() method (#1252) * Add job.properties() method * add reno --- qiskit_ibm_runtime/runtime_job.py | 15 +++++++++++++++ .../notes/job-properties-2b5c2f66c50d7d2d.yaml | 6 ++++++ 2 files changed, 21 insertions(+) create mode 100644 releasenotes/notes/job-properties-2b5c2f66c50d7d2d.yaml diff --git a/qiskit_ibm_runtime/runtime_job.py b/qiskit_ibm_runtime/runtime_job.py index 7606865d0..f448e376d 100644 --- a/qiskit_ibm_runtime/runtime_job.py +++ b/qiskit_ibm_runtime/runtime_job.py @@ -24,6 +24,7 @@ from qiskit.providers.backend import Backend from qiskit.providers.jobstatus import JobStatus, JOB_FINAL_STATES +from qiskit.providers.models import BackendProperties from qiskit.providers.job import JobV1 as Job # pylint: disable=unused-import,cyclic-import @@ -429,6 +430,20 @@ def update_tags(self, new_tags: List[str]) -> List[str]: "the job.".format(self.job_id()) ) + def properties(self, refresh: bool = False) -> Optional[BackendProperties]: + """Return the backend properties for this job. + + Args: + refresh: If ``True``, re-query the server for the backend properties. + Otherwise, return a cached version. + + Returns: + The backend properties used for this job, at the time the job was run, + or ``None`` if properties are not available. + """ + + return self._backend.properties(refresh, self.creation_date) + def _set_status_and_error_message(self) -> None: """Fetch and set status and error message.""" if self._status not in JOB_FINAL_STATES: diff --git a/releasenotes/notes/job-properties-2b5c2f66c50d7d2d.yaml b/releasenotes/notes/job-properties-2b5c2f66c50d7d2d.yaml new file mode 100644 index 000000000..cd9bfcad4 --- /dev/null +++ b/releasenotes/notes/job-properties-2b5c2f66c50d7d2d.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Added a new method :meth:`~qiskit_ibm_runtime.RuntimeJob.properties` which returns the + backend properties of the job at the time the job was run. +