-
Notifications
You must be signed in to change notification settings - Fork 112
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
Conversation
These are emitted through the logging module, which is clunkier to work with
QiskitRuntimeService._original_least_busy = QiskitRuntimeService.least_busy | ||
|
||
# Backends that we have access to through both internal and open plans | ||
# Keep this in sync with | ||
# 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) |
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.
This function patches least_busy
to make sure we only use open-provider backends. The existing logic won't work any more, so I've updated it with hardcoded names like we did in #3273.
# 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) |
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.
Runtime emits warnings through logging
rather than warnings
, which is a bit clunkier to work with.
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.
This would be useful feedback to share with the Runtime team
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.
Thanks! I think https://github.com/Qiskit/documentation/pull/3246/files may change some of this, like the channel should be ibm_quantum_platform fwict
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.
Thank you 🙏
Can you please update our README in closed source for how to generate the token?
# 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 |
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.
# 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) |
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.
This would be useful feedback to share with the Runtime team
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
# Keep this in sync with | |
# Keep this in sync with `OPEN_BACKENDS` in |
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
# Keep this in sync with | |
# | |
# Keep this in sync with `OPEN_BACKENDS_TO_INTERNAL` |
This PR migrates our notebook testing setup to use the IBM Cloud provider rather than the legacy provider.