Client object

Client class for interacting with the Qibo server.

This module implements the main Client class for managing interactions with the remote Qibo server, including job submission and monitoring.

class qibo_client.qibo_client.Client(token: str, url: str)

Bases: object

Client for managing Qibo server interactions.

This class provides a high-level interface for submitting quantum computing jobs to the Qibo server, monitoring their progress, and retrieving results.

token

Authentication token for server access

headers

HTTP headers including authentication

base_url

Base URL for the Qibo server API

pid

Process ID of the most recent job

results_folder

Folder where job results are stored

results_path

Path to the most recent results file

check_client_server_qibo_versions()

Check that client and server qibo package versions match.

Validates that the local Qibo version meets the server’s requirements and optionally warns if the local version is older than the server’s.

Raises:

RuntimeError – If the local qibo version is below the server’s minimum

run_circuit(circuit: Circuit, device: str, project: str = 'personal', nshots: int | None = None, verbatim: bool = False) QiboJob | None

Run a quantum circuit on the cluster.

This method submits a quantum circuit to the Qibo server for execution and returns a job object that can be used to monitor status and retrieve results.

Parameters:
  • circuit – The Qibo circuit to run

  • device – The device to execute the circuit on

  • project – The project to associate with this job. Defaults to “personal”

  • nshots – Number of measurement shots (quantum executions)

  • verbatim – If True, attempts to run circuit without transpilation

Returns:

QiboJob object for monitoring the job, or None if submission failed

Raises:

JobPostServerError – If the server fails to process the job submission

print_quota_info()

Print or log user quota information.

Retrieves disk usage and project quota information from the server and displays it using the configured UI (Rich or plain logging).

Returns:

None

print_job_info()

Print or log information about completed jobs.

Retrieves job information from the server and displays it. Expects at most one user account.

Raises:

ValueError – If multiple user accounts are found in job list

get_job(pid: str) QiboJob

Retrieve an existing job by process ID.

Parameters:

pid – Process ID of the job to retrieve

Returns:

QiboJob object representing the retrieved job

delete_job(pid: str)

Remove a job from the server.

Parameters:

pid – Process ID of the job to delete

delete_all_jobs() list[str]

Remove all jobs from the server.

Returns:

List of PIDs that were deleted

Job object

Core QiboJob class and related helpers.

This module implements the main job class for interacting with Qibo quantum computing framework services, including job submission, monitoring, and result retrieval.

class qibo_client.qibo_job.QiboJobStatus(value)

Bases: Enum

Enumeration of possible job statuses.

These represent the lifecycle stages a job can go through from submission to completion.

QUEUEING = 1

Job is in the queue waiting for resources

PENDING = 2

Job is pending execution

RUNNING = 3

Job is actively running

POSTPROCESSING = 4

Job is being post-processed (results being generated)

SUCCESS = 5

Job completed successfully

ERROR = 6

Job failed with an error

qibo_client.qibo_job.convert_str_to_job_status(status: str) QiboJobStatus | None

Convert a string to the corresponding QiboJobStatus enum.

Parameters:

status – String representation of job status

Returns:

QiboJobStatus enum value if successful, None if not recognized

class qibo_client.qibo_job.QiboJob(pid: str, base_url: str, headers: Dict[str, str] | None = None, circuit: dict | None = None, nshots: int | None = None, device: str | None = None, project: str | None = None)

Bases: object

Job object representing a Qibo quantum computing job.

This class manages the lifecycle of a quantum computing job, including status polling, result retrieval, and cleanup.

base_url

The API base URL for the server

headers

Headers to include in API requests

pid

Process ID identifying this job

circuit

Circuit JSON representation

nshots

Number of measurements/shots

device

Device being used for execution

project

Project name for this job

_status

Current job status (queued to completion)

queue_position

Current position in execution queue

seconds_to_job_start

Estimated seconds until job starts

queue_last_update

Last time queue status was updated

results_folder

Folder where results are stored

results_path

Path to the results file

refresh() QiboJobStatus

Refresh job information from the server.

Retrieves current job details including status, queue position, and estimated time-to-start. Updates the job object in place.

Returns:

The current QiboJobStatus enum value

status() QiboJobStatus

Get the current job status.

This is a convenience method that delegates to refresh().

Returns:

The current QiboJobStatus enum value

running() bool

Check if the job is currently running.

Returns:

True if job status is RUNNING, False otherwise

success() bool

Check if the job completed successfully.

Returns:

True if job status is SUCCESS, False otherwise

result(wait: float = 0.5, verbose: bool = True) QuantumState | None

Poll server until completion, then download and return result.

This method continuously polls the job status until completion and then downloads and extracts the results archive.

Parameters:
  • wait – Seconds between status checks

  • verbose – Whether to display status updates

Returns:

qibo.result.QuantumState if successful, None if job failed or download failed

delete() Response

Delete a job from the server.

Returns:

The server response after deletion attempt