IQMCircuitJob#
Module: iqm.qrisp_iqm.backends
- class iqm.qrisp_iqm.backends.IQMCircuitJob(job: Any, *, backend: iqm.qrisp_iqm.backends.IQMBackend)#
Job handle for gate-level circuit execution.
Returned by
run_async()when the submitted circuit contains noIQMPulseOperationinstructions.Example:
>>> from qrisp import QuantumCircuit >>> from iqm.qrisp_iqm import IQMBackend, IQMCircuitJob >>> backend = IQMBackend(device_instance="garnet", token="...") >>> qc = QuantumCircuit(2) >>> qc.h(0); qc.cx(0, 1); qc.measure(qc.qubits) >>> job = backend.run_async(qc, shots=1000) >>> isinstance(job, IQMCircuitJob) True >>> result = job.result() # waits for completion, returns JobResult
Attributes
The
IQMBackendthat created this job.Identifier for this job, or
Noneif not yet assigned.The most recently cached
JobStatusfor this job.Methods
Attempt to cancel the job on the IQM server.
Return
Trueif the job was cancelled.Return
Trueif the job has completed successfully and results are available.Return
Trueif the job has reached a terminal state.Return
Trueif the job is waiting in the backend queue.Fetch the latest status from the backend and return it.
Block until the job completes and return its measurement results.
Return
Trueif the job is currently executing.Query and return the current job status.
- Parameters:
job (Any)
backend (qrisp_IQMBackend)
- property backend: iqm.qrisp_iqm.backends.IQMBackend#
The
IQMBackendthat created this job.
- cancel() bool#
Attempt to cancel the job on the IQM server.
- Returns:
Trueiff cancellation was successful.- Return type:
- done() bool#
Return
Trueif the job has completed successfully and results are available.- Return type:
- in_final_state() bool#
Return
Trueif the job has reached a terminal state.Terminal states are
DONE,CANCELLED, andERROR.- Return type:
- property last_known_status: JobStatus#
The most recently cached
JobStatusfor this job.This value is initialised to
INITIALIZINGand is updated at the following points:status(): every live query updates the cache as a side effect.result(): transitions toDONE,CANCELLED, orERRORwhen the job reaches a terminal state.refresh(): explicitly fetches the live status and caches it (semantically identical to callingstatus(), but signals intent clearly when the sole purpose is to refresh the cache).
- refresh() JobStatus#
Fetch the latest status from the backend and return it.
Delegates to
status(), which already updateslast_known_statusas a side effect. This method exists as a named alias that makes the intent explicit: the caller wants to refresh the cached status, not merely query it.- Returns:
The freshly fetched status.
- Return type:
- result(timeout: float | None = None) JobResult#
Block until the job completes and return its measurement results.
Waits for the IQM job to reach a terminal state on the server, and then parses and returns the measurement counts, or raises an appropriate error.
- Parameters:
timeout (float | None) – Maximum number of seconds to wait for the job to finish.
Nonemeans use the default client timeout.- Returns:
The measurement results.
- Raises:
TimeoutError – If
timeoutis specified and the job does not finish in time.JobFailureError – If the job terminated with an error.
JobCancelledError – If the job was cancelled.
- Return type:
JobResult
- status() JobStatus#
Query and return the current job status.
This is a live query that fetches the latest status from the IQM server, which involves a network call.
- Returns:
The current status of the job.
- Return type:
JobStatus