# 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](../backend/index.html.md#mqt.core.plugins.qiskit.backend.QDMIBackend), programs: [Sequence](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence)[[CompiledProgram](../../../mlir/index.html.md#mqt.core.mlir.CompiledProgram)], , shots: [int](https://docs.python.org/3/builtins/functions.html#int), memory: [bool](https://docs.python.org/3/builtins/functions.html#bool), max_retries: [int](https://docs.python.org/3/builtins/functions.html#int) = 0, job_parameters: [QDMIJobParameters](../../../typing/index.html.md#mqt.core.typing.QDMIJobParameters) | [None](https://docs.python.org/3/builtins/constants.html#None) = None)

Bases: [`qiskit.providers.JobV1`](https://quantum.cloud.ibm.com/docs/api/qiskit/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.
  * **programs** – Compiled programs and their output-bit mappings.
  * **shots** – Requested shots per circuit.
  * **memory** – Whether to collect individual 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](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[BatchEntry](../../qdmi_batch/index.html.md#mqt.core.plugins.qdmi_batch.BatchEntry)[qiskit.result.models.ExperimentResult], ...]*

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

#### collect() → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[BatchEntry](../../qdmi_batch/index.html.md#mqt.core.plugins.qdmi_batch.BatchEntry)[qiskit.result.models.ExperimentResult], ...]

Read existing jobs without replacement executions or aggregate errors.

* **Returns:**
  Entry snapshots; successful results are cached.

#### resubmit(indices: [Sequence](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence)[[int](https://docs.python.org/3/builtins/functions.html#int)], , allow_unknown: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [QDMIJob](#mqt.core.plugins.qiskit.job.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()`](#mqt.core.plugins.qiskit.job.QDMIJob.submit) for
entries that have never been submitted.

* **Returns:**
  This batch handle, with earlier attempts retained.

#### job_id() → [str](https://docs.python.org/3/builtins/stdtypes.html#str)

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

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

* **Raises:**
  [**JobExecutionError**](../exceptions/index.html.md#mqt.core.plugins.qiskit.exceptions.JobExecutionError) – If the first entry has no job handle.

#### cancel() → [bool](https://docs.python.org/3/builtins/functions.html#bool)

Disable automatic retries and attempt to cancel every job.

* **Returns:**
  Whether all cancellation requests succeeded.

#### result() → [Result](https://quantum.cloud.ibm.com/docs/api/qiskit/qiskit.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`](../exceptions/index.html.md#mqt.core.plugins.qiskit.exceptions.JobSubmissionError) with
this batch handle if submission fails.

* **Returns:**
  The result of the job with one ExperimentResult per circuit.
* **Raises:**
  [**JobExecutionError**](../exceptions/index.html.md#mqt.core.plugins.qiskit.exceptions.JobExecutionError) – If collection or result assembly fails.

#### status() → [JobStatus](https://quantum.cloud.ibm.com/docs/api/qiskit/qiskit.providers.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**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If the job status is unknown.

#### submit(indices: [Sequence](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence)[[int](https://docs.python.org/3/builtins/functions.html#int)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [None](https://docs.python.org/3/builtins/constants.html#None)

Submit selected untouched entries, or all remaining untouched entries.

Previously attempted entries require [`resubmit()`](#mqt.core.plugins.qiskit.job.QDMIJob.resubmit).
