qibo_client package

Submodules

qibo_client.config module

This module implements some constants and custom exceptions

exception qibo_client.config.MalformedResponseError(message='Server response body does not contain all the expected keys')

Bases: Exception

Exception raised when server responsed body does not contain expected keys

exception qibo_client.config.JobPostServerError(message='Server failed to post job to queue')

Bases: Exception

Exception raised when server fails to post the job to the queue.

The client should handle such error to aknowledge that job submission was not successful without crashing.

qibo_client.qibo_client module

The module implementing the TIIProvider class.

qibo_client.qibo_client.wait_for_response_to_get_request(url: str) Response

Wait until the server completes the computation and return the response.

Parameters:

url (str) – the endpoint to make the request

Returns:

the response of the get request

Return type:

requests.models.Response

qibo_client.qibo_client.check_response_has_keys(response: Response, keys: List[str])

Check that the response body contains certain keys.

Parameters:
  • response (requests.models.Response) – the server response

  • keys (List[str]) – the keys to be checked in the response body

Raises:

MalformedResponseError – if the server response does not contain all the expected keys.

class qibo_client.qibo_client.Client(token: str, url: str = 'https://cloud.qibo.science/')

Bases: object

Class to manage the interaction with the remote server.

check_client_server_qibo_versions()

Check that client and server qibo package installed versions match.

Raise assertion error if the two versions are not the same.

run_circuit(circuit: Circuit, nshots: int = 1000, device: str = 'sim') ndarray | None

Run circuit on the cluster.

Parameters:
  • circuit (Circuit) – the QASM representation of the circuit to run

  • nshots (int) – number of shots

  • device (str) – the device to run the circuit on. Default device is sim

Returns:

the numpy array with the results of the computation. None if the job raised an error.

Return type:

np.ndarray

Module contents

The qibo_tii_provider package