cirq_superstaq.worker

Classes

Task

A single task to be executed on the machine.

Worker

A client for superstaq target workers. Contains the logic to retrieve circuits, return

Module Contents

class cirq_superstaq.worker.Task

A single task to be executed on the machine.

circuit: cirq.Circuit
metadata: dict[str, object]
shots: int
task_id: str
user_email: str | None
class cirq_superstaq.worker.Worker(worker_api_token: str, remote_host: str | None = None, api_version: str = 'v0.3.0', max_retry_seconds: float = 60, verbose: bool = False)

A client for superstaq target workers. Contains the logic to retrieve circuits, return results to the server and update the machine specs in the target database.

get_next_task() Task | None

Get next task for this machine from Superstaq. If no task is found, then return None.

get_task_status(task_id: str) general_superstaq.models.CircuitStatus

Get the status of a task from Superstaq. This allows the hardware to query if a user has canceled the task.

post_result(task_id: str, bitstrings: collections.abc.Collection[str] | None, status_message: str | None = None) None

Post the result of a task to Superstaq. Note the server will perform verification of the task result including checking if the number of shots in the bitstring is equal to the number requested and if the bitstrings match the set of qubit_readout operations requested.

post_task_status(task_id: str, status: general_superstaq.models.CircuitStatus, status_message: str | None = None) None

Post the status of a task to Superstaq.

update_target_status(status: general_superstaq.models.TargetStatus, **config: object) None

Method to update the current machine status to Superstaq.