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 backend related functions in RuntimeClient #55

Merged
merged 3 commits into from
Dec 13, 2021
Merged
Changes from 2 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
56 changes: 55 additions & 1 deletion qiskit_ibm_runtime/api/clients/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"""Client for accessing IBM Quantum runtime service."""

import logging
from typing import Any, Dict, Optional
from typing import Any, Dict, List, Optional

from qiskit_ibm_runtime.credentials import Credentials
from qiskit_ibm_runtime.api.session import RetrySession
Expand Down Expand Up @@ -278,3 +278,57 @@ def job_logs(self, job_id: str) -> str:
def logout(self) -> None:
"""Clear authorization cache."""
self.api.logout()

# IBM Cloud only functions

def list_backends(self) -> List[Dict[str, Any]]:
"""Return IBM Cloud backends available for this service instance.

Returns:
IBM Cloud backends available for this service instance.
"""
return self.api.backends()

def backend_configuration(self, backend_name: str) -> Dict[str, Any]:
"""Return the configuration of the IBM Cloud backend.

Args:
backend_name: The name of the IBM Cloud backend.

Returns:
Backend configuration.
"""
return self.api.backend(backend_name).configuration()

def backend_status(self, backend_name: str) -> Dict[str, Any]:
"""Return the status of the IBM Cloud backend.

Args:
backend_name: The name of the IBM Cloud backend.

Returns:
Backend status.
"""
return self.api.backend(backend_name).status()

def backend_properties(self, backend_name: str) -> Dict[str, Any]:
"""Return the properties of the IBM Cloud backend.

Args:
backend_name: The name of the IBM Cloud backend.

Returns:
Backend properties.
"""
return self.api.backend(backend_name).properties()

def backend_pulse_defaults(self, backend_name: str) -> Dict:
"""Return the pulse defaults of the IBM Cloud backend.

Args:
backend_name: The name of the IBM Cloud backend.

Returns:
Backend pulse defaults.
"""
return self.api.backend(backend_name).pulse_defaults()