general_superstaq.machine_api

API client for collecting machine tasks from Superstaq server.

Classes

MachineAPI

API for machine workers.

Module Contents

class general_superstaq.machine_api.MachineAPI(client_name: str, api_key: str | None = None, remote_host: str | None = None, api_version: str = gss.API_VERSION, circuit_type: general_superstaq.models.CircuitType = gss.models.CircuitType.CIRQ, max_retry_seconds: float = 60, verbose: bool = False)

Bases: general_superstaq.superstaq_client._BaseSuperstaqClient

API for machine workers.

get_next_task() general_superstaq.models.WorkerTask | 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, status: general_superstaq.models.CircuitStatus, bitstrings: collections.abc.Collection[str] | None = 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.

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

Method to update the current machine status to Superstaq.