qiskit-documentation/scripts/nb-tester/qiskit_docs_notebook_tester/patches/qiskit-ibm-runtime-open

12 lines
478 B
Plaintext

# nb-tester: allow-write
# Only select backends available on the open plan
from qiskit_ibm_runtime import QiskitRuntimeService
QiskitRuntimeService._original_least_busy = QiskitRuntimeService.least_busy
def patched_least_busy(self, *args, **kwargs):
open_backends = [b.name for b in self.backends(instance="ibm-q/open/main")]
return self._original_least_busy(filters=lambda backend: backend.name in open_backends)
QiskitRuntimeService.least_busy = patched_least_busy