-
Notifications
You must be signed in to change notification settings - Fork 111
Migrate testing to cloud #3363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Migrate testing to cloud #3363
Changes from all commits
15a16fe
8bf6cb5
5093a8f
4cbe23f
02ac859
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,12 +25,30 @@ | |
|
||
# We always run the following code in the kernel before running the notebook | ||
PRE_EXECUTE_CODE = """\ | ||
import logging | ||
import re | ||
# Import with underscores to avoid interfering with user-facing code. | ||
from matplotlib import set_loglevel as _set_mpl_loglevel | ||
|
||
|
||
# See https://github.com/matplotlib/matplotlib/issues/23326#issuecomment-1164772708 | ||
_set_mpl_loglevel("critical") | ||
|
||
|
||
# Ignore server configuration warnings from qiskit-ibm-runtime; we can't control these and they seem to be benign | ||
def _runtime_warnings_filter(record): | ||
return False | ||
ignore_patterns = { | ||
# If you add more patterns, make sure to add the filter to the correct logger path using getLogger | ||
r'Remote backend "[_a-z]+" for service instance .+ could not be instantiated due to an invalid server-side configuration', | ||
r"Unable to create configuration for [_a-z]+. 'NoneType' object has no attribute 'basis_gates'" | ||
} | ||
if any(re.match(pattern, record.getMessage()) for pattern in ignore_patterns): | ||
return False | ||
return True | ||
|
||
# We must add the filter to each module that emits warnings to be filtered | ||
logging.getLogger("qiskit_ibm_runtime.utils.backend_decoder").addFilter(_runtime_warnings_filter) | ||
logging.getLogger("qiskit_ibm_runtime.qiskit_runtime_service").addFilter(_runtime_warnings_filter) | ||
Comment on lines
+37
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Runtime emits warnings through There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be useful feedback to share with the Runtime team |
||
""" | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -28,7 +28,8 @@ | |||||
from .config import NotebookJob, Result | ||||||
from .post_process import post_process_notebook | ||||||
|
||||||
|
||||||
# Keep this in sync with | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
# scripts/nb-tester/qiskit_docs_notebook_tester/patches/qiskit-ibm-runtime-open | ||||||
OPEN_BACKENDS_TO_INTERNAL = { | ||||||
"ibm_brisbane": "alt_brisbane", | ||||||
"ibm_torino": "alt_torino", | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -4,8 +4,15 @@ from qiskit_ibm_runtime import QiskitRuntimeService | |||||||
|
||||||||
QiskitRuntimeService._original_least_busy = QiskitRuntimeService.least_busy | ||||||||
|
||||||||
# Backends that we have access to through both internal and open plans | ||||||||
# Keep this in sync with | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
# scripts/nb-tester/qiskit_docs_notebook_tester/execute.py | ||||||||
OPEN_BACKENDS = ["brisbane", "torino"] | ||||||||
|
||||||||
def is_open(backend): | ||||||||
return any(backend.name.endswith(f"_{name}") for name in OPEN_BACKENDS) | ||||||||
|
||||||||
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) | ||||||||
return self._original_least_busy(filters=is_open) | ||||||||
Comment on lines
5
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function patches |
||||||||
|
||||||||
QiskitRuntimeService.least_busy = patched_least_busy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, could you please check in with the Qiskit Runtime team in
#qiskit-runtime-open
in Slack about these? It would be good to confirm they're aware of them. We don't want users encountering these issues. Depending on their reply, we should probably create a GH issue to track reverting this patch.