mqt.core.plugins.qiskit.job

QDMI Qiskit Job implementation.

Provides a Qiskit JobV1-compatible wrapper for QDMI job execution and results.

Module Contents

class QDMIJob(backend: QDMIBackend, circuits: Sequence[QuantumCircuit], *, shots: int, memory: bool, max_retries: int = 0, job_parameters: QDMIJobParameters | None = None)

Bases: qiskit.providers.JobV1

Qiskit job wrapping one or more QDMI jobs.

This class handles both single-circuit and multi-circuit execution, using native program lists where supported and independent jobs otherwise. Construction prepares an unsubmitted batch.

Parameters:
  • backend – The backend this job runs on.

  • circuits – The executed circuits, used to snapshot result headers.

  • shots – Requested shots per circuit.

  • memory – Whether to collect genuine ordered shots.

  • max_retries – Lifetime replacement limit per confirmed failed entry; disabled by default. Cancelled or uncertain jobs are never retried.

  • job_parameters – Custom submission parameters retained for replacements.

property entries: tuple[BatchEntry[qiskit.result.models.ExperimentResult], ...]

Ordered snapshots of inputs, submission attempts, results, and failures.

collect() → tuple[BatchEntry[qiskit.result.models.ExperimentResult], ...]

Read existing jobs without replacement executions or aggregate errors.

Returns:

Entry snapshots; successful results are cached.

resubmit(indices: Sequence[int], *, allow_unknown: bool = False) → QDMIJob

Explicitly replace selected entries of a batch created by backend.run.

Unknown outcomes require allow_unknown=True and may duplicate work. Running or completed jobs cannot be replaced. Use submit() for entries that have never been submitted.

Returns:

This batch handle, with earlier attempts retained.

job_id() → str

Return the first entry’s earliest accepted remote job ID.

The ID is queried on demand and stays unchanged across replacements.

Raises:

JobExecutionError – If the first entry has no job handle.

cancel() → bool

Disable automatic retries and attempt to cancel every job.

Returns:

Whether all cancellation requests succeeded.

result() → Result

Get the result of the job.

For multi-circuit jobs, this aggregates results from all submitted circuits. An automatic replacement can propagate JobSubmissionError with this batch handle if submission fails.

Returns:

The result of the job with one ExperimentResult per circuit.

Raises:

JobExecutionError – If collection or result assembly fails.

status() → JobStatus

Get the status of the job.

For multi-circuit jobs, returns the most relevant status: - ERROR if any job failed - CANCELLED if any job was canceled (and none failed) - RUNNING if any job is running (and none failed/canceled) - QUEUED if any job is queued (and none failed/canceled/running) - DONE if all jobs are done

Returns:

The aggregated status of the job(s).

Raises:

ValueError – If the job status is unknown.

submit(indices: Sequence[int] | None = None) → None

Submit selected untouched entries, or all remaining untouched entries.

Previously attempted entries require resubmit().