Skip to content

Enumerations ​

This page documents the enumerations used across the qcloud module for job status, data formats, noise models, and logging.

JobStatus ​

Represents the lifecycle status of a quantum cloud job.

ValueDescription
WAITINGThe job is waiting to be processed
COMPUTINGThe job is currently being executed on the backend
FINISHEDThe job has completed successfully
FAILEDThe job has failed during execution
QUEUINGThe job is queued and waiting for available resources

FAILED is terminal; since 0.5.1, QCloudJob.result() returns server-reported failures as results instead of raising.

Example ​

python
from pyqpanda3.qcloud import JobStatus

# JobStatus is the value QCloudJob.status() reports.
status = JobStatus.FINISHED
if status == JobStatus.FINISHED:
    print("Job finished")
elif status == JobStatus.FAILED:
    print("Job failed")

DataFormat ​

Specifies the data format used for quantum circuit export and communication with cloud backends.

NOTE

DataFormat is exported from pyqpanda3.qcloud via from pyqpanda3.qcloud import DataFormat.

ValueDescription
DEFAULTDefault format; behavior depends on the context or backend implementation
BINARYCompact binary format for efficient transmission and storage
INSTRUCTION_SETExplicit sequence of instructions or gate operations

DataBase ​

Specifies the numeric base used for representing quantum measurement results.

ValueDescription
BinaryBase-2 (binary) representation, e.g., "0010"
HexBase-16 (hexadecimal) representation, e.g., "0x2"

Example ​

python
from pyqpanda3.qcloud import DataBase

# DataBase selects the key format of QCloudResult.get_probs():
#   DataBase.Binary -> keys like '00', '11'
#   DataBase.Hex    -> keys like '0x0', '0x3'
for base in (DataBase.Binary, DataBase.Hex):
    print(base.name, base.value)

NOISE_MODEL ​

Defines the types of quantum noise models available for cloud-based noisy simulations.

ValueDescription
BITFLIP_KRAUS_OPERATORBit-flip noise model (X error with probability p)
BIT_PHASE_FLIP_OPERATORBit-phase flip noise model (Y error with probability p)
DAMPING_KRAUS_OPERATORAmplitude damping noise model (energy dissipation)
DECOHERENCE_KRAUS_OPERATORCombined decoherence noise model (T1 and T2 relaxation)
DEPHASING_KRAUS_OPERATORPhase damping noise model (loss of phase coherence)
DEPOLARIZING_KRAUS_OPERATORDepolarizing noise model (uniform error on all Pauli axes)
PHASE_DAMPING_OPERATORPhase damping noise model (pure dephasing)

Example ​

python
from pyqpanda3.qcloud import QCloudNoiseModel, NOISE_MODEL

# Create a decoherence noise model
# Note: QCloudNoiseModel accepts positional arguments only
# DECOHERENCE_KRAUS_OPERATOR requires exactly 3 elements each
noise = QCloudNoiseModel(
    NOISE_MODEL.DECOHERENCE_KRAUS_OPERATOR,
    [0.001, 0.002, 0.003],
    [0.01, 0.02, 0.03]
)

LogLevel ​

Defines logging verbosity levels for the cloud service.

ValueDescription
CLOUD_INFOInformational messages about normal operations
CLOUD_DEBUGDetailed debug messages for troubleshooting
CLOUD_WARNINGWarning messages about potential issues
CLOUD_ERRORError messages about failures

Example ​

python
from pyqpanda3.qcloud import LogLevel

# LogLevel values define verbosity levels for cloud service logging
print(LogLevel.CLOUD_INFO)
print(LogLevel.CLOUD_DEBUG)
print(LogLevel.CLOUD_WARNING)
print(LogLevel.CLOUD_ERROR)

Output:

LogLevel.CLOUD_INFO
LogLevel.CLOUD_DEBUG
LogLevel.CLOUD_WARNING
LogLevel.CLOUD_ERROR

LogOutput ​

Specifies the destination for log output from the cloud service.

ValueDescription
CONSOLELog messages are printed to the console (standard output)
FILELog messages are written to a file

Example ​

python
from pyqpanda3.qcloud import QCloudService, LogOutput

service = QCloudService(api_key="your_api_key")
service.setup_logging(output=LogOutput.FILE, file_path="qcloud_debug.log")

See Also ​

Released under the MIT License.