Skip to content

Commit

Permalink
add instances method (#1040)
Browse files Browse the repository at this point in the history
  • Loading branch information
kt474 authored Aug 29, 2023
1 parent e757a0a commit 721f9f8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions qiskit_ibm_runtime/qiskit_runtime_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,16 @@ def least_busy(
raise QiskitBackendNotFoundError("No backend matches the criteria.")
return min(candidates, key=lambda b: b.status().pending_jobs)

def instances(self) -> List[str]:
"""Return the IBM Quantum instances list currently in use for the session.
Returns:
A list with instances currently in the session.
"""
if self._channel == "ibm_quantum":
return list(self._hgps.keys())
return []

@property
def auth(self) -> str:
"""Return the authentication type used.
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/instances-method-02fda1de98638e59.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
features:
- |
Added a new method, :meth:`qiskit_ibm_runtime.QiskitRuntimeService.instances` that returns
all instances(hub/group/project) the user is in. This is only for the ``ibm_quantum`` channel
since the ``ibm_cloud`` channel does not have multiple instances.

0 comments on commit 721f9f8

Please sign in to comment.