Skip to content

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Migrate testing to cloud #3363

wants to merge 5 commits into from

Conversation

frankharkins
Copy link
Member

@frankharkins frankharkins commented Jun 18, 2025

This PR migrates our notebook testing setup to use the IBM Cloud provider rather than the legacy provider.

Comment on lines 5 to +16
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)
Copy link
Member Author

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.

Comment on lines +37 to +51
# 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)
Copy link
Member Author

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.

Copy link
Collaborator

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

@frankharkins frankharkins marked this pull request as ready for review June 18, 2025 18:46
Copy link
Collaborator

@Eric-Arellano Eric-Arellano left a 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

Copy link
Collaborator

@Eric-Arellano Eric-Arellano left a 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
Copy link
Collaborator

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.

Comment on lines +37 to +51
# 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)
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Keep this in sync with
#
# Keep this in sync with `OPEN_BACKENDS_TO_INTERNAL`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants