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, execute
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 = execute(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:

bool

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:
  • timeout (Optional[float]) – Time after which the method times out.

  • wait (float) – Time for which the method sleeps before making a new attempt to get the results from the web API.

Raises:
Return type:

Result

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 performed job.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 compiler job.result().to_dict()["results"][0]["num_swaps"].

status()[source]

Return the status of the job.

Return type:

JobStatus

Returns:

The status.

submit()[source]

Not implemented.

Please use QRydSimulator.run() or execute() to submit a job.

Raises:

NotImplementedError – If the method is called.

Return type:

None