File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
scripts/nb-tester/qiskit_docs_notebook_tester Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 25
25
26
26
# We always run the following code in the kernel before running the notebook
27
27
PRE_EXECUTE_CODE = """\
28
+ import logging
29
+ import re
28
30
# Import with underscores to avoid interfering with user-facing code.
29
31
from matplotlib import set_loglevel as _set_mpl_loglevel
30
32
31
-
32
33
# See https://github.com/matplotlib/matplotlib/issues/23326#issuecomment-1164772708
33
34
_set_mpl_loglevel("critical")
35
+
36
+
37
+ # Ignore server configuration warnings from qiskit-ibm-runtime; we can't control these and they seem to be benign
38
+ def _runtime_warnings_filter(record):
39
+ return False
40
+ ignore_patterns = {
41
+ # If you add more patterns, make sure to add the filter to the correct logger path using getLogger
42
+ r'Remote backend "[_a-z]+" for service instance .+ could not be instantiated due to an invalid server-side configuration',
43
+ r"Unable to create configuration for [_a-z]+. 'NoneType' object has no attribute 'basis_gates'"
44
+ }
45
+ if any(re.match(pattern, record.getMessage()) for pattern in ignore_patterns):
46
+ return False
47
+ return True
48
+
49
+ # We must add the filter to each module that emits warnings to be filtered
50
+ logging.getLogger("qiskit_ibm_runtime.utils.backend_decoder").addFilter(_runtime_warnings_filter)
51
+ logging.getLogger("qiskit_ibm_runtime.qiskit_runtime_service").addFilter(_runtime_warnings_filter)
34
52
"""
35
53
36
54
You can’t perform that action at this time.
0 commit comments