mqt.core.plugins.pennylane.job

In-process recovery of a preprocessed PennyLane execution batch.

Module Contents

class PennyLaneJob(device: QDMIDevice, prepared: Sequence[tuple[CompiledProgram | None, tuple[int, ...]]], tapes: Sequence[QuantumScript], *, single: bool, max_retries: int, submit_programs: Callable[[Sequence[int], Sequence[CompiledProgram], int], Job | None])

Retain results and attempts for one preprocessed device batch.

Obtain this handle through device.last_job or an execution error’s job attribute. Results have the device’s preprocessed tape shape; they do not reconstruct an interrupted QNode or gradient calculation. Automatic retries use the device’s setting at creation, applied over each entry’s lifetime. Cancelled or uncertain jobs are never retried automatically.

property entries: tuple[BatchEntry[object], ...]

Ordered attempts with completed per-tape measurement results.

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

Submit selected untouched entries, or all remaining untouched entries.

Previously attempted entries require resubmit().

collect() → tuple[BatchEntry[object], ...]

Read existing jobs without replacement executions or aggregate errors.

Returns:

Entry snapshots; successful results are cached.

result() → pennylane.typing.Result | pennylane.typing.ResultBatch

Collect, retry confirmed failures, and assemble the device’s usual output.

Submission or collection failures propagate PennyLaneExecutionError with this batch handle.

Returns:

Measurement results for the preprocessed input tapes.

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

Replace selected failed or cancelled entries, retaining earlier attempts.

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 previous attempts retained.

cancel() → bool

Disable automatic retries and explicitly cancel known attempts.

Returns:

Whether all cancellation requests succeeded without uncertain admissions.