qrisp.interface.Job.result#

abstractmethod Job.result(timeout: float | None = None) JobResult[source]#

Block until the job reaches a terminal state and return its result.

This is a blocking call: it does not return until the job is in one of the terminal states: DONE, CANCELLED, or ERROR. The internal synchronisation mechanism (threading, polling, asyncio, etc.) is left entirely to the concrete implementation.

If the job is already in a terminal state when this method is called, it must return (or raise) immediately without blocking.

Concrete implementations should call _raise_for_status() once the terminal state has been reached, before returning.

Parameters:
timeoutfloat or None, optional

Maximum number of seconds to wait for the job to finish. None (default) waits indefinitely. Implementations that support this parameter should raise TimeoutError when the deadline expires.

Returns:
JobResult

The measurement results, if the job completed successfully (DONE).

Raises:
JobFailureError

If the job terminated in ERROR state.

JobCancelledError

If the job was cancelled (CANCELLED).

TimeoutError

If timeout is specified and the job does not finish in time.