Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add job.properties() method #1252

Merged
merged 2 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.