-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add nb-tester patch to only select open plan backends (#2455)
This PR adds a new patch that picks the least busy backend that's also available on the open plan, regardless of which instance you're using. We need this because we've added the `test_eagle_us-east` device to the instance we use for testing. The problem is that this device is always the least busy, so it'll be selected when we're doing our hardware runs. We can't just switch to the open instance for this test because I'm regularly out of credits and the priority is too low to run all the jobs in our time window.
- Loading branch information
1 parent
7ae965c
commit bc5f48c
Showing
2 changed files
with
13 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# 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 |