Job
- class qiskit_qryd_provider.QRydJob(backend, job_url, session, options, circuit)[source]
Job that is run on QRydDemo’s infrastructure.
This class provides methods for controlling the job, accessing its status and result. The class communicates with QRydDemo’s infrastructure via our web API. The job runs asynchronously.
Typical usage example:
from qiskit_qryd_provider import QRydProvider from qiskit import QuantumCircuit, transpile import os provider = QRydProvider(os.getenv("QRYD_API_TOKEN")) backend = provider.get_backend("qryd_emulator$square") qc = QuantumCircuit(2, 2) qc.h(0) qc.cx(0, 1) qc.measure([0, 1], [0, 1]) job = backend.run(transpile(qc, backend), shots=200) print(job.result().get_counts())
- __init__(backend, job_url, session, options, circuit)[source]
Initializes the asynchronous job.
- Parameters:
backend (
QRydBackend
) – The backend used to run the job.job_url (
str
) – URL to the API endpoint that points to the job created on the server.session (
Session
) – Session object that manages the connection to the API server.options (
Options
) – Options specified within the used backend.circuit (
QuantumCircuit
) – The QuantumCircuit that is submitted as a job.
- cancel()[source]
Attempt to cancel the job.
- Return type:
- Returns:
A boolean that indicates whether the cancellation has been successful.
- result(timeout=None, wait=0.2)[source]
Return the result of the job.
- Parameters:
- Raises:
qiskit.providers.JobTimeoutError – If the method timed out.
qiskit.providers.JobError – If the job failed.
requests.HTTPError – If the web API did not accept a request.
- Return type:
- Returns:
A Qiskit result object that contains the measurement outcomes.
In addition, after converting the object to a dictionary, we can access the metadata of the job:
meta = job.result().to_dict()["results"][0]["metadata"]
.meta["device"]
: The device on which the job has been executed.meta["method"]
: How the job has been executed.meta["noise"]
: Details about the noise model.meta["precision"]
: The considered numerical precision.meta["num_qubits"]
: Number of qubits.meta["num_clbits"]
: Number of classical bits.meta["executed_single_qubit_gates"]
: Number of single-qubit gates.meta["executed_two_qubit_gates"]
: Number of two-qubit gates.meta["fusion_max_qubits"]
: Maximum number of fused gates.meta["fusion_avg_qubits"]
: Average number of fused gates.meta["fusion_generated_gates"]
: Number of gates after gate fusion.
Moreover, we can read out the execution time
job.result().to_dict()["results"][0]["time_taken"]
and the number of measurements performedjob.result().to_dict()["results"][0]["shots"]
.We can obtain the compilation time
job.result().to_dict()["results"][0]["compilation_time"]
and the number of SWAP gates inserted by the compilerjob.result().to_dict()["results"][0]["num_swaps"]
.
- submit()[source]
Not implemented.
Please use
QRydSimulator.run()
to submit a job.- Raises:
NotImplementedError – If the method is called.
- Return type: