Skip to content

Commit

Permalink
Don't cache target in target_history (#1791)
Browse files Browse the repository at this point in the history
* Don't cache target in target_history

* Don't cache target

* unit tests

* Add release note
  • Loading branch information
kt474 authored Jul 15, 2024
1 parent 8b42e36 commit 08d053b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions qiskit_ibm_runtime/ibm_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ def target(self) -> Target:
Returns:
Target
"""
self._get_properties()
self._get_properties(datetime=python_datetime.now())
self._get_defaults()
self._convert_to_target()
self._convert_to_target(refresh=True)
return self._target

def target_history(self, datetime: Optional[python_datetime] = None) -> Target:
Expand Down
2 changes: 2 additions & 0 deletions release-notes/unreleased/1791.bug.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed an issue where calling :meth:`IBMBackend.target_history` would cache the backend target and
then calling :meth:`IBMBackend.target` would incorrectly return that cached target.
2 changes: 0 additions & 2 deletions test/unit/mock/fake_runtime_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,6 @@ def backend_status(self, backend_name: str) -> Dict[str, Any]:

def backend_properties(self, backend_name: str, datetime: Any = None) -> Dict[str, Any]:
"""Return the properties of a backend."""
if datetime:
raise NotImplementedError("'datetime' is not supported.")
if ret := self._find_backend(backend_name).properties:
return ret.copy()
return None
Expand Down

0 comments on commit 08d053b

Please sign in to comment.