Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
concurrent.futures._base.Executor Class Reference
Inheritance diagram for concurrent.futures._base.Executor:
Inheritance graph
[legend]
Collaboration diagram for concurrent.futures._base.Executor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def submit
def map
def shutdown
def __enter__
def __exit__

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Detailed Description

This is an abstract base class for concrete asynchronous executors.

Definition at line 502 of file _base.py.


Member Function Documentation

Definition at line 562 of file _base.py.

00562 
00563     def __enter__(self):
00564         return self

def concurrent.futures._base.Executor.__exit__ (   self,
  exc_type,
  exc_val,
  exc_tb 
)

Definition at line 565 of file _base.py.

00565 
00566     def __exit__(self, exc_type, exc_val, exc_tb):
00567         self.shutdown(wait=True)
00568         return False

Here is the call graph for this function:

Here is the caller graph for this function:

def concurrent.futures._base.Executor.map (   self,
  fn,
  iterables,
  timeout = None 
)
Returns a iterator equivalent to map(fn, iter).

Args:
    fn: A callable that will take take as many arguments as there are
passed iterables.
    timeout: The maximum number of seconds to wait. If None, then there
is no limit on the wait time.

Returns:
    An iterator equivalent to: map(func, *iterables) but the calls may
    be evaluated out-of-order.

Raises:
    TimeoutError: If the entire result iterator could not be generated
before the given timeout.
    Exception: If fn(*args) raises for any values.

Definition at line 516 of file _base.py.

00516 
00517     def map(self, fn, *iterables, timeout=None):
00518         """Returns a iterator equivalent to map(fn, iter).
00519 
00520         Args:
00521             fn: A callable that will take take as many arguments as there are
00522                 passed iterables.
00523             timeout: The maximum number of seconds to wait. If None, then there
00524                 is no limit on the wait time.
00525 
00526         Returns:
00527             An iterator equivalent to: map(func, *iterables) but the calls may
00528             be evaluated out-of-order.
00529 
00530         Raises:
00531             TimeoutError: If the entire result iterator could not be generated
00532                 before the given timeout.
00533             Exception: If fn(*args) raises for any values.
00534         """
00535         if timeout is not None:
00536             end_time = timeout + time.time()
00537 
00538         fs = [self.submit(fn, *args) for args in zip(*iterables)]
00539 
00540         try:
00541             for future in fs:
00542                 if timeout is None:
00543                     yield future.result()
00544                 else:
00545                     yield future.result(end_time - time.time())
00546         finally:
00547             for future in fs:
00548                 future.cancel()

Here is the call graph for this function:

def concurrent.futures._base.Executor.shutdown (   self,
  wait = True 
)
Clean-up the resources associated with the Executor.

It is safe to call this method several times. Otherwise, no other
methods can be called after this one.

Args:
    wait: If True then shutdown will not return until all running
futures have finished executing and the resources used by the
executor have been reclaimed.

Reimplemented in concurrent.futures.process.ProcessPoolExecutor, and concurrent.futures.thread.ThreadPoolExecutor.

Definition at line 549 of file _base.py.

00549 
00550     def shutdown(self, wait=True):
00551         """Clean-up the resources associated with the Executor.
00552 
00553         It is safe to call this method several times. Otherwise, no other
00554         methods can be called after this one.
00555 
00556         Args:
00557             wait: If True then shutdown will not return until all running
00558                 futures have finished executing and the resources used by the
00559                 executor have been reclaimed.
00560         """
00561         pass

Here is the caller graph for this function:

def concurrent.futures._base.Executor.submit (   self,
  fn,
  args,
  kwargs 
)
Submits a callable to be executed with the given arguments.

Schedules the callable to be executed as fn(*args, **kwargs) and returns
a Future instance representing the execution of the callable.

Returns:
    A Future representing the given call.

Reimplemented in concurrent.futures.process.ProcessPoolExecutor, and concurrent.futures.thread.ThreadPoolExecutor.

Definition at line 505 of file _base.py.

00505 
00506     def submit(self, fn, *args, **kwargs):
00507         """Submits a callable to be executed with the given arguments.
00508 
00509         Schedules the callable to be executed as fn(*args, **kwargs) and returns
00510         a Future instance representing the execution of the callable.
00511 
00512         Returns:
00513             A Future representing the given call.
00514         """
00515         raise NotImplementedError()

Here is the caller graph for this function:


Member Data Documentation

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


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