futures#

class Future(proc: HPCProcess, polling_interval: float = 1.0)#

Bases: object

done() bool#
cancelled() bool#
cancel() bool#
result(timeout: float | None = None) int#
add_done_callback(fn: Callable[[Future], None])#
add_jobstart_callback(fn: Callable[[Future], None])#
add_jobid_callback(fn: Callable[[Future], None])#
property jobid: str#
property returncode: int | None#
as_completed(futures: Iterable[Future], timeout: float | None = None, polling_interval: float = 1.0, cancel_on_exception: bool = True) Generator[Future, None, None]#

Yield HPCFuture objects as they complete, similar to concurrent.futures.as_completed.

Parameters:
  • futures – Iterable of HPCFuture objects to monitor.

  • timeout – Maximum number of seconds to wait for all futures. If None, wait indefinitely.

  • polling_interval – Seconds between checks of each future’s done() status.

  • cancel_on_exception – If True, cancel all pending futures if an exception occurs during iteration.

Yields:

HPCFuture objects in the order they complete.

Raises:
  • TimeoutError – If the timeout expires before all futures are complete. All pending futures are cancelled before raising.

  • Exception – Propagates exceptions raised by iterating over futures. Pending futures are cancelled first if cancel_on_exception is True.