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:
JobV1Qiskit 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) andprogram(backward-compatible alias for the first program). Both are set at construction and safe to inspect beforesubmit().- qm¶
qm.QuantumMachineor cloud QM used for execution.
- job_id¶
QM SDK job identifier (updated on
submit()).
- metadata¶
Run options dict (compiler_options, simulate, timeout, …).
Use
qm_jobandresult_handlesfor 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 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:
RuntimeError – If the job has not been submitted yet.
IndexError – If idx is out of range.
- 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.runlogic.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 localQMJobor cloudIQCCJob.
- 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 viaqm.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).
- property result_handles: Any¶
QM SDK result stream handles after
submit().Always a list — one
result_handlesper 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:
RuntimeError – If the job has not been submitted yet.
IndexError – If idx is out of range.