qrisp.interface.BatchedBackend.dispatch#

BatchedBackend.dispatch(timeout: float | None = None) None[source]#

Execute all pending circuits and populate their results.

All queued circuits are submitted via run_async(), eliminating redundant network round-trips and queue-wait overhead regardless of whether the circuits were queued with the same or different shot counts.

When all queued circuits share the same shot count a scalar is passed to run_async(). When circuits carry different shot counts the full per-circuit list is passed, enabling each circuit to be executed with its own shot budget. Backends whose SDK does not natively support per-circuit shot counts should fall back to a fixed shot count and emit a UserWarning.

If the wrapped backend’s max_circuits limit is set and the queued batch exceeds it, the batch is automatically split into smaller jobs and a UserWarning is emitted.

If the wrapped backend raises, that error is stored in every not-yet-populated MeasurementResult and then re-raised. Accessing any of those results later will re-raise the stored exception.

Parameters:
timeoutfloat or None, optional

Maximum seconds to wait for each hardware job. None (default) waits indefinitely. Passed through to Job.result.

Raises:
UserWarning

If the batch is split across multiple jobs due to max_circuits.

TimeoutError

If timeout is given and a hardware job does not finish in time. Results for all circuits in the batch are left unpopulated.

Exception

Re-raises any exception thrown by the wrapped backend during execution, after injecting the error into all pending results.