Public Member Functions | List of all members
grpc.framework.foundation.future.Future Class Reference
Inheritance diagram for grpc.framework.foundation.future.Future:
Inheritance graph
[legend]

Public Member Functions

def add_done_callback (self, fn)
 
def cancel (self)
 
def cancelled (self)
 
def done (self)
 
def exception (self, timeout=None)
 
def result (self, timeout=None)
 
def running (self)
 
def traceback (self, timeout=None)
 

Detailed Description

A representation of a computation in another control flow.

  Computations represented by a Future may be yet to be begun, may be ongoing,
  or may have already completed.

Definition at line 47 of file future.py.

Member Function Documentation

◆ add_done_callback()

def grpc.framework.foundation.future.Future.add_done_callback (   self,
  fn 
)
Adds a function to be called at completion of the computation.

    The callback will be passed this Future object describing the outcome of
    the computation.

    If the computation has already completed, the callback will be called
    immediately.

    Args:
      fn: A callable taking this Future object as its single parameter.

Definition at line 209 of file future.py.

◆ cancel()

def grpc.framework.foundation.future.Future.cancel (   self)
Attempts to cancel the computation.

    This method does not block.

    Returns:
      True if the computation has not yet begun, will not be allowed to take
place, and determination of both was possible without blocking. False
under all other circumstances including but not limited to the
computation's already having begun, the computation's already having
finished, and the computation's having been scheduled for execution on a
remote system for which a determination of whether or not it commenced
before being cancelled cannot be made without blocking.

Definition at line 65 of file future.py.

◆ cancelled()

def grpc.framework.foundation.future.Future.cancelled (   self)
Describes whether the computation was cancelled.

    This method does not block.

    Returns:
      True if the computation was cancelled any time before its result became
immediately available. False under all other circumstances including but
not limited to this object's cancel method not having been called and
the computation's result having become immediately available.

Definition at line 96 of file future.py.

◆ done()

def grpc.framework.foundation.future.Future.done (   self)
Describes whether the computation has taken place.

    This method does not block.

    Returns:
      True if the computation is known to have either completed or have been
unscheduled or interrupted. False if the computation may possibly be
executing or scheduled to execute later.

Definition at line 127 of file future.py.

◆ exception()

def grpc.framework.foundation.future.Future.exception (   self,
  timeout = None 
)
Return the exception raised by the computation.

    This method may return immediately or may block.

    Args:
      timeout: The length of time in seconds to wait for the computation to
terminate or be cancelled, or None if this method should block until
the computation is terminated or is cancelled no matter how long that
takes.

    Returns:
      The exception raised by the computation, or None if the computation did
not raise an exception.

    Raises:
      TimeoutError: If a timeout value is passed and the computation does not
terminate within the allotted time.
      CancelledError: If the computation was cancelled.

Definition at line 163 of file future.py.

◆ result()

def grpc.framework.foundation.future.Future.result (   self,
  timeout = None 
)
Accesses the outcome of the computation or raises its exception.

    This method may return immediately or may block.

    Args:
      timeout: The length of time in seconds to wait for the computation to
finish or be cancelled, or None if this method should block until the
computation has finished or is cancelled no matter how long that takes.

    Returns:
      The return value of the computation.

    Raises:
      TimeoutError: If a timeout value is passed and the computation does not
terminate within the allotted time.
      CancelledError: If the computation was cancelled.
      Exception: If the computation raised an exception, this call will raise
the same exception.

Definition at line 140 of file future.py.

◆ running()

def grpc.framework.foundation.future.Future.running (   self)
Describes whether the computation is taking place.

    This method does not block.

    Returns:
      True if the computation is scheduled to take place in the future or is
taking place now, or False if the computation took place in the past or
was cancelled.

Definition at line 110 of file future.py.

◆ traceback()

def grpc.framework.foundation.future.Future.traceback (   self,
  timeout = None 
)
Access the traceback of the exception raised by the computation.

    This method may return immediately or may block.

    Args:
      timeout: The length of time in seconds to wait for the computation to
terminate or be cancelled, or None if this method should block until
the computation is terminated or is cancelled no matter how long that
takes.

    Returns:
      The traceback of the exception raised by the computation, or None if the
computation did not raise an exception.

    Raises:
      TimeoutError: If a timeout value is passed and the computation does not
terminate within the allotted time.
      CancelledError: If the computation was cancelled.

Definition at line 186 of file future.py.


The documentation for this class was generated from the following file:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:32