Skip to content
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

Add try/except when creating backend obj #2048

Merged
merged 10 commits into from
Dec 5, 2024
16 changes: 11 additions & 5 deletions qiskit_ibm_runtime/qiskit_runtime_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,17 @@ def _create_backend_obj(
Raises:
QiskitBackendNotFoundError: if the backend is not in the hgp passed in.
"""
if config := configuration_from_server_data(
raw_config=self._api_client.backend_configuration(backend_name),
instance=instance,
use_fractional_gates=use_fractional_gates,
):
try:
config = configuration_from_server_data(
raw_config=self._api_client.backend_configuration(backend_name),
instance=instance,
use_fractional_gates=use_fractional_gates,
)
except Exception as ex: # pylint: disable=broad-except
logger.warning("Unable to create retrieve configuration for %s. %s ", backend_name, ex)
return None

if config:
if self._channel == "ibm_quantum":
if not instance:
for hgp in list(self._hgps.values()):
Expand Down
2 changes: 2 additions & 0 deletions release-notes/unreleased/2048.bug.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Invalid or non-existing backend configurations on the server will no longer
prevent all backends from being retrieved with ``service.backends()``.
Loading