Skip to content

Commit

Permalink
Add job.properties() method (#1252)
Browse files Browse the repository at this point in the history
* Add job.properties() method

* add reno
  • Loading branch information
kt474 authored Dec 4, 2023
1 parent a9350ac commit af432b7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions qiskit_ibm_runtime/runtime_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/job-properties-2b5c2f66c50d7d2d.yaml
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit af432b7

Please sign in to comment.