QMJob

class QMJob(backend: QMBackend, job_id: str, qm: QuantumMachine | CloudQuantumMachine, program: Program | List[Program], result_function: Callable[[List[RunningQmJob | QmPendingJob]], Result], **kwargs)[source][source]

Bases: JobV1

Qiskit job handle for QUA program execution on a QM backend.

Returned by run(). Compile the generated QUA source with:

from qm import generate_qua_script
print(generate_qua_script(job.programs[0]))

Compiled QUA programs are exposed on programs (always a list) and program (backward-compatible alias for the first program). Both are set at construction and safe to inspect before submit().

qm

qm.QuantumMachine or cloud QM used for execution.

backend

QMBackend that built the program.

job_id

QM SDK job identifier (updated on submit()).

metadata

Run options dict (compiler_options, simulate, timeout, …).

Use qm_job and result_handles for the live QM SDK object and measurement streams after submission.

Initializes the asynchronous job.

Parameters:
  • backend – the backend used to run the job.

  • job_id – a unique id in the context of the backend used to run the job.

  • kwargs – Any key value metadata to associate with this job.

property programs: List[Program]

Compiled QUA program(s) for this job; always a list.

property program: Program

Backward-compatible alias for programs[0].

property qm_jobs: List[RunningQmJob | QmPendingJob] | None

Underlying QM SDK jobs after submit() — always a list.

Length 1 for single-program execution; one entry per chunk otherwise.

get_qm_job(idx: int | None = None)[source][source]

Return the QM SDK job at idx (default: first / only job).

Convenience accessor equivalent to job.qm_jobs[idx].

Raises:
get_program(idx: int | None = None) Program[source][source]

Return the compiled QUA program at idx (default: first / only program).

Convenience accessor equivalent to job.programs[idx].

Raises:

IndexError – If idx is out of range.

classmethod from_circuits(backend: QMBackend, run_input: QuantumCircuit | List[QuantumCircuit], **options) QMJob[source][source]

Factory that mirrors the original QMBackend.run logic.

This method performs: - circuit validation and optional reset insertion, - target / calibration updates, - QUA program generation via plan_run_programs, - result object construction from streamed data, - and submission of either a local QMJob or cloud IQCCJob.

status() JobStatus[source][source]

Return Qiskit job status mapped from the underlying QM job(s).

Aggregates across all chunk jobs: DONE only when every program is done.

submit()[source][source]

Compile and queue all QUA programs on the Quantum Machine.

For local QM backends, all programs are first compiled via qm.compile() and then added to the OPX queue via qm.queue.add_compiled(). Separating compilation from execution means all programs are compiled upfront so the OPX can execute them back-to-back without recompilation stalls between chunks.

Simulation is handled separately (no queue used).

cancel()[source][source]

Cancel all underlying QM job(s).

result()[source][source]

Build and return a Qiskit Result from QM streaming data.

property result_handles: Any

QM SDK result stream handles after submit().

Always a list — one result_handles per submitted job. Length 1 for non-chunked execution. Raises if not yet submitted.

get_result_handles(idx: int | None = None)[source][source]

Return the result-handles object at idx (default: first / only job).

Convenience accessor equivalent to job.result_handles[idx]. Defaults to index 0, which is the correct handle for non-chunked execution.

Raises: