qpandalite.task.platform_template package#
Submodules#
qpandalite.task.platform_template.task module#
Platform template defining the standard task interface.
This module specifies the common API that every platform backend must
implement. The functions below are stubs (pass) and serve only as a
contract reference. Each platform sub-module (e.g. origin_qcloud,
quafu, ibm) provides its own concrete implementation of these
functions.
- Public API:
submit_task — Submit quantum circuit(s) for execution.
query_by_taskid — Asynchronously query task status by task ID.
query_by_taskid_sync — Synchronously query task status (blocking).
query_all_task — Query status of all locally recorded tasks.
- qpandalite.task.platform_template.task.query_all_task(url, savepath, **kwargs)[源代码]
Query the status of all locally recorded tasks.
Iterates over tasks saved in savepath and queries each one from the backend, caching finished results locally.
- 参数:
url (Union[str, Any]) -- Backend query endpoint URL.
savepath (Union[str, Any]) -- Directory containing local task records.
**kwargs -- Additional platform-specific keyword arguments.
- 返回:
A
(finished_count, total_count)pair.- 返回类型:
tuple[int, int]
- qpandalite.task.platform_template.task.query_by_taskid(taskid, url, **kwargs)[源代码]
Asynchronously query the status of one or more tasks by task ID.
This function returns immediately without waiting for the task to finish.
- 参数:
taskid (Union[List[str], str]) -- A single task ID or a list of task IDs.
url (Union[str, Any]) -- Backend query endpoint URL.
**kwargs -- Additional platform-specific keyword arguments.
- 返回:
A dict with
'status'('success'|'failed'|'running') and'result'(present when status is'success'or'failed').- 返回类型:
dict
- qpandalite.task.platform_template.task.query_by_taskid_sync(taskid, interval, timeout, retry, url, **kwargs)[源代码]
Synchronously query task status, blocking until completion or timeout.
Polls the backend at regular intervals until the task finishes, times out, or retries are exhausted.
- 参数:
taskid (Union[List[str], str]) -- A single task ID or a list of task IDs.
interval (float) -- Polling interval in seconds.
timeout (float) -- Maximum total wait time in seconds.
retry (int) -- Number of retry attempts on transient errors.
url (Union[str, Any]) -- Backend query endpoint URL.
**kwargs -- Additional platform-specific keyword arguments.
- 返回:
The execution results once the task succeeds.
- 返回类型:
list[dict]
- 抛出:
TimeoutError -- If timeout is exceeded.
RuntimeError -- If the task fails or retries are exhausted.
- qpandalite.task.platform_template.task.submit_task(circuit, task_name, tasktype, chip_id, shots, circuit_optimize, measurement_amend, auto_mapping, specified_block, savepath, url, **kwargs)[源代码]
Submit one or more quantum circuits for execution on the backend.
- 参数:
circuit (Union[List[str], str]) -- A single OriginIR circuit string or a list of OriginIR circuit strings.
task_name (str) -- Human-readable name for the task.
tasktype (Any) -- Backend-specific task type identifier.
chip_id (Any) -- Identifier for the target quantum chip.
shots (int) -- Number of measurement shots per circuit.
circuit_optimize (Union[bool, Any]) -- Whether to apply circuit optimization / transpilation.
measurement_amend (Union[bool, Any]) -- Whether to apply measurement error mitigation.
auto_mapping (Union[bool, Any]) -- Whether to automatically map logical qubits to physical qubits.
specified_block (Union[bool, Any]) -- Reserved — specify a physical block on the chip.
savepath (os.PathLike) -- Directory for persisting local task records.
url (Union[str, Any]) -- Backend submission endpoint URL.
**kwargs -- Additional platform-specific keyword arguments.
- 返回:
The task ID assigned by the backend.
- 返回类型:
str
Module contents#
Platform interface template — stub definitions for the standard task API.