uniqc.backend_adapter.task.adapters.tianyan_adapter module

TianYan (天衍) backend adapter.

Submits QCIS circuits to the TianYan quantum cloud platform using cqlib.

Installation:

pip install unified-quantum[tianyan]

uniqc.backend_adapter.task.adapters.tianyan_adapter.TIANYAN_SIMULATOR_NAMES = frozenset({'tianyan_s', 'tianyan_sa', 'tianyan_sw', 'tianyan_tn', 'tianyan_tnn'})

Cloud simulator machine names reported by the platform.

class uniqc.backend_adapter.task.adapters.tianyan_adapter.TianyanAdapter(machine_name=None)[source]

Bases: QuantumAdapter

Adapter for the TianYan quantum cloud platform (天衍) using cqlib.

Credentials are read from uniqc.config.load_tianyan_config() (tianyan.login_key). Both the cqlib SDK import and the credential load are lazy so that importing this module never requires the SDK or a configured account.

Note

The cqlib package is required for this adapter. Install with: pip install unified-quantum[tianyan]

dry_run(originir, *, shots=1000, **kwargs)[source]

Dry-run validation for TianYan backends.

Validates offline: OriginIR parses, all gates map to QCIS, and qubit indices fit the QINIT size. Makes NO network calls and does not require cqlib or credentials.

Note

Any dry-run success followed by actual submission failure is a critical bug. Please report it at the UnifiedQuantum issue tracker.

get_chip_characterization(chip_name)[source]

Return per-qubit and per-pair calibration data for a TianYan machine.

Uses cqlib’s authenticated download_config endpoint. (The unauthenticated get_machine_config/gplot endpoint sits behind a web-application firewall and is not usable from SDK clients.)

Parameters:

chip_name – TianYan machine name, e.g. "tianyan176".

Returns:

None when cqlib is unavailable or the machine config cannot be downloaded.

Return type:

ChipCharacterization or None

is_available()[source]

Return True if cqlib is installed and a login_key is configured.

list_backends()[source]

Return raw TianYan machine metadata.

query_quantum_computer_list() returns rows of [id, price, status, name] (e.g. ['1764555284795101186', 'free', 'running', 'tianyan176']). Known simulator machines are appended when the API omits them.

Returns:

name, available, status, machine_id, price, is_simulator, num_qubits, num_qubits_source.

Return type:

List of dicts with keys

num_qubits is the machine’s live qubit count from download_config whenever that authenticated call succeeds (num_qubits_source == "live_config"); otherwise it falls back to the digits embedded in the machine name (num_qubits_source == "machine_name"), which is the model name, not necessarily the online qubit count (e.g. tianyan176 has had 66 qubits online).

max_native_batch_size = 1
name = 'tianyan'
query(taskid)[source]

Query a single task’s status (non-blocking).

Parameters:

taskid – cqlib query_id.

Returns:

taskid, status, result (counts dict when status is 'success', error payload when 'failed').

Return type:

dict with keys

query_batch(taskids)[source]

Query multiple tasks and merge results.

Overall status is the worst case: failed > running > success.

submit(circuit, *, shots=1000, **kwargs)[source]

Submit a single circuit to TianYan.

Parameters:
  • circuit – QCIS text (as produced by TianyanCircuitAdapter). OriginIR input (detected by its QINIT header) is translated first for convenience.

  • shots – Number of measurement shots.

  • **kwargs – Additional options: - machine_name: Target machine (e.g. "tianyan176") - task_name / exp_name: Optional experiment name - lab_id: Optional lab id passed through to cqlib

Returns:

cqlib query_id string.

submit_batch(circuits, *, shots=1000, **kwargs)[source]

Submit circuits one by one (one query_id per circuit).

cqlib’s batch interface is limited, so uniqc slices batches into per-circuit jobs (max_native_batch_size == 1).

translate_circuit(originir)[source]

Convert an OriginIR string to QCIS text (purely local).

Parameters:

originir – OriginIR format circuit string.

Returns:

QCIS text for TianYanPlatform.submit_job.