Client object

The module implementing the Client class.

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 = 'k2') QuantumState | 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 k2

  • wait_for_results (bool) – whether to let the client hang until server results are ready or not. Defaults to True.

Returns:

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

Return type:

Optional[QiboJobResult]

print_quota_info()

Logs the formatted user quota info table.

print_job_info()

Logs the formatted user quota info table.

get_job(pid: str) QiboJob

Retrieves the job from the unique process id.

Parameters:

pid (str) – the job’s process identifier

Returns:

the requested QiboJob object

Return type:

QiboJob

Job object

qibo_client.qibo_job.convert_str_to_job_status(status: str)
class qibo_client.qibo_job.QiboJobStatus(value)

Bases: Enum

An enumeration.

QUEUED = 'to_do'
RUNNING = 'in_progress'
DONE = 'success'
ERROR = 'error'
class qibo_client.qibo_job.QiboJob(pid: str, base_url: str = 'https://cloud.qibo.science', circuit: Circuit | None = None, nshots: int | None = None, device: str | None = None)

Bases: object

refresh()

Refreshes job information from server.

This method does not query the results from server.

status() QiboJobStatus
running() bool
done() bool
result(wait: int = 5, verbose: bool = False) QuantumState | None

Send requests to server checking whether the job is completed.

This function populates the Client.results_folder and Client.results_path attributes.

Returns:

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

Return type:

T.Optional[np.ndarray]