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, device: str, nshots: int | None = None) QuantumState | MeasurementOutcomes | CircuitResult | None

Run circuit on the cluster.

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

  • nshots (int) – number of shots, mandatory for non-simulation devices, defaults to nshots=100 for simulation partitions

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

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

Returns:

the result 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

delete_job(pid: str)

Removes the given job from the web server.

Parameters:

pid (str) – the job’s process identifier

Job object

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

Bases: Enum

An enumeration.

QUEUEING = 'queueing'
PENDING = 'pending'
RUNNING = 'running'
POSTPROCESSING = 'postprocessing'
SUCCESS = '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
success() 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]

delete() str