Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Use job creation date when returning backend properties in job.properties() #746

Merged
merged 3 commits into from
Oct 9, 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
7 changes: 2 additions & 5 deletions qiskit_ibm_provider/job/ibm_composite_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,13 @@ def _async_submit(self, sub_job: SubJob) -> None:

@_requires_submit
def properties(
self, refresh: bool = False, datetime: Optional[python_datetime] = None
self, refresh: bool = False
) -> Optional[Union[List[BackendProperties], 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.
datetime: By specifying `datetime`, this function returns an instance
of the :class:`BackendProperties<qiskit.providers.models.BackendProperties>`
whose timestamp is closest to, but older than, the specified `datetime`.

Note:
This method blocks until all sub-jobs are submitted.
Expand All @@ -401,7 +398,7 @@ def properties(
self._properties = []
properties_ts = []
for job in self._get_circuit_jobs():
props = job.properties(refresh, datetime)
props = job.properties(refresh)
if props.last_update_date not in properties_ts:
self._properties.append(props)
properties_ts.append(props.last_update_date)
Expand Down
13 changes: 4 additions & 9 deletions qiskit_ibm_provider/job/ibm_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,18 @@ def __init__(
# Append suffix to key to avoid conflicts.
self._data[key + "_"] = value

def properties(
self, refresh: bool = False, datetime: Optional[python_datetime] = None
) -> Optional[BackendProperties]:
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.
datetime: By specifying `datetime`, this function returns an instance
of the :class:`BackendProperties<qiskit.providers.models.BackendProperties>`
whose timestamp is closest to, but older than, the specified `datetime`.

Returns:
The backend properties used for this job, or ``None`` if
properties are not available.
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, datetime)
return self._backend.properties(refresh, self.creation_date())

@abstractmethod
def result(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
fixes:
- |
When retrieving the backend properties of a job with
:meth:`~qiskit_ibm_provider.job.IBMJob.properties`, the job creation date is now
used to get the specific backend properties used when the job was run.

Loading