uniqc.task.adapters.base module#
Base adapter interface for quantum cloud backends.
Every backend adapter must implement this interface, providing: 1. Translation from OriginIR string to the provider’s native circuit type. 2. Task submission via the provider’s Python SDK (not raw REST). 3. Task status query and result retrieval.
The adapter layer replaces all direct requests REST calls within the
task modules. Each adapter is a stateful object that holds the provider
session / client and configuration.
- class uniqc.task.adapters.base.QuantumAdapter[source]#
Bases:
ABCAbstract base class for quantum cloud backend adapters.
Subclass this for each backend (originq_cloud, quafu, ibm, …). Each adapter is instantiated once per task module and reused.
- is_available()[source]#
Return True if the required packages / credentials are configured.
Defaults to
Falseso that subclasses must explicitly opt-in, avoiding the risk of an unconfigured adapter incorrectly reporting availability.- Return type:
- list_backends()[source]#
Return raw backend metadata from the platform API.
Returns a list of dicts with at least a
"name"key. The dict shape is platform-specific; the caller is responsible for normalising the data intoBackendInfoobjects.
- abstractmethod query(taskid)[source]#
Query a single task’s status and result.
- Parameters:
taskid (str) – Task identifier.
- Returns:
status:'success'|'failed'|'running'result: execution result (present when status is'success'or'failed')
- Return type:
dict with keys
- abstractmethod query_batch(taskids)[source]#
Query multiple tasks’ status and merge results.
Overall status is the worst case:
'failed'>'running'>'success'.
- abstractmethod submit(circuit, *, shots=1000, **kwargs)[source]#
Submit a circuit to the backend and return a task ID.