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

Give warning when backend is not active #890

Merged
merged 8 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion qiskit_ibm_runtime/qiskit_runtime_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ def run(
elif isinstance(options, Dict):
qrt_options = RuntimeOptions(**options)

# If using params object, extract as dictionary
# If using params object, extract as dictionary.
if isinstance(inputs, ParameterNamespace):
inputs.validate()
inputs = vars(inputs)
Expand All @@ -1007,6 +1007,12 @@ def run(
instance=qrt_options.instance, backend_name=qrt_options.backend
)
hgp_name = hgp.name
backend = self.backend(name=qrt_options.backend, instance=hgp_name)
status = backend.status()
if status.operational is True and status.status_msg != "active":
warnings.warn(
f"The backend {backend.name} currently has a status of {status.status_msg}."
)

try:
response = self._api_client.program_run(
Expand Down
5 changes: 5 additions & 0 deletions releasenotes/notes/non_active_backend-2fcdbbc3d902f2a3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
features:
- |
Added warning when the backend is not active in
QiskitRuntimeService.run.