Qiskit / qiskit-ibm-runtime

IBM Client for Qiskit Runtime
https://docs.quantum.ibm.com/api/qiskit-ibm-runtime
Apache License 2.0
161 stars 157 forks source link

FakeBackend.refresh() doesn't always refresh #1993

Open jyu00 opened 1 month ago

jyu00 commented 1 month ago

Describe the bug

The refresh() method in FakeBackendV2 only refreshes if the backend configuration changes:

https://github.com/Qiskit/qiskit-ibm-runtime/blob/2e969ffc11eec7d8a1c283998272f630f913cf55/qiskit_ibm_runtime/fake_provider/fake_backend.py#L600

But there is a high chance backend properties/defaults would change even if configuration stays the same.

In addition, it uses the cached objects even when updates are made:

https://github.com/Qiskit/qiskit-ibm-runtime/blob/2e969ffc11eec7d8a1c283998272f630f913cf55/qiskit_ibm_runtime/fake_provider/fake_backend.py#L593-L595

But one would expect refresh() to fetch the latest and greatest.

Steps to reproduce

Expected behavior

Suggested solutions

This refresh() should always fetch/store the latest server data.

Additional Information