CompositeFuture#
- class biotite.application_v2.CompositeFuture(*futures: Future[Any])[source]#
Bases:
Future[tuple[Unpack[Ts]]]A future combining the results of multiple futures.
The composite is done when all input futures are done. Cancelling it propagates the cancellation request to every input future that is still running. Its result is a tuple containing the input results in the same order as the input futures.
- Parameters:
- *futuresFuture
The futures to combine. Their order determines the order of the returned results.
- cancel() bool#
Abort the run.
- Returns:
- cancelledbool
True, if the run was cancelled, or False if it had already finished and could not be cancelled anymore.
- cancelled() bool#
Return True, if the run was cancelled.
- Returns:
- bool
True if the run was cancelled, False otherwise.
- done() bool#
Return True, if the run was cancelled or has finished.
- Returns:
- bool
True if the run was cancelled or has finished, False otherwise.
Notes
A finished run may still raise an exception in
result().
- exception(timeout: float | None = None) Exception | None#
Wait for the run to finish and return the exception it raised.
- Parameters:
- timeoutfloat, optional
The maximum number of seconds to wait. By default, the method waits indefinitely.
- Returns:
- exceptionException or None
The exception raised by the run, or None if it finished without error.
- Raises:
- TimeoutError
If the run does not finish within timeout seconds.
- CancelledError
If the run was cancelled.
- result(timeout: float | None = None) T#
Wait for the run to finish and return its result.
- Parameters:
- timeoutfloat, optional
The maximum number of seconds to wait. By default, the method waits indefinitely.
- Returns:
- resultobject
The result object of the run.
- Raises:
- TimeoutError
If the run does not finish within timeout seconds.
- CancelledError
If the run was cancelled.
- running() bool#
Return True, if the run is currently in progress.
- Returns:
- bool
True if the run is currently in progress, False otherwise.