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 no IQMPulseOperation instructions.

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

backend

The IQMBackend that created this job.

job_id

Identifier for this job, or None if not yet assigned.

last_known_status

The most recently cached JobStatus for this job.

Methods

cancel

Attempt to cancel the job on the IQM server.

cancelled

Return True if the job was cancelled.

done

Return True if the job has completed successfully and results are available.

in_final_state

Return True if the job has reached a terminal state.

queued

Return True if the job is waiting in the backend queue.

refresh

Fetch the latest status from the backend and return it.

result

Block until the job completes and return its measurement results.

running

Return True if the job is currently executing.

status

Query and return the current job status.

Parameters:
  • job (Any)

  • backend (qrisp_IQMBackend)

property backend: iqm.qrisp_iqm.backends.IQMBackend#

The IQMBackend that created this job.

cancel() bool#

Attempt to cancel the job on the IQM server.

Returns:

True iff cancellation was successful.

Return type:

bool

cancelled() bool#

Return True if the job was cancelled.

Return type:

bool

done() bool#

Return True if the job has completed successfully and results are available.

Return type:

bool

in_final_state() bool#

Return True if the job has reached a terminal state.

Terminal states are DONE, CANCELLED, and ERROR.

Return type:

bool

property job_id: str | None#

Identifier for this job, or None if not yet assigned.

property last_known_status: JobStatus#

The most recently cached JobStatus for this job.

This value is initialised to INITIALIZING and is updated at the following points:

  • status(): every live query updates the cache as a side effect.

  • result(): transitions to DONE, CANCELLED, or ERROR when the job reaches a terminal state.

  • refresh(): explicitly fetches the live status and caches it (semantically identical to calling status(), but signals intent clearly when the sole purpose is to refresh the cache).

queued() bool#

Return True if the job is waiting in the backend queue.

Return type:

bool

refresh() JobStatus#

Fetch the latest status from the backend and return it.

Delegates to status(), which already updates last_known_status as 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:

JobStatus

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. None means use the default client timeout.

Returns:

The measurement results.

Raises:
  • TimeoutError – If timeout is 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

running() bool#

Return True if the job is currently executing.

Return type:

bool

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