Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
multiprocessing.pool.MapResult Class Reference
Inheritance diagram for multiprocessing.pool.MapResult:
Inheritance graph
[legend]
Collaboration diagram for multiprocessing.pool.MapResult:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def ready
def successful
def wait
def get

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Member Functions

def _set

Private Attributes

 _success
 _value
 _chunksize
 _number_left
 _ready

Detailed Description

Definition at line 572 of file pool.py.


Constructor & Destructor Documentation

def multiprocessing.pool.MapResult.__init__ (   self,
  cache,
  chunksize,
  length,
  callback,
  error_callback 
)

Definition at line 574 of file pool.py.

00574 
00575     def __init__(self, cache, chunksize, length, callback, error_callback):
00576         ApplyResult.__init__(self, cache, callback,
00577                              error_callback=error_callback)
00578         self._success = True
00579         self._value = [None] * length
00580         self._chunksize = chunksize
00581         if chunksize <= 0:
00582             self._number_left = 0
00583             self._ready = True
00584         else:
00585             self._number_left = length//chunksize + bool(length % chunksize)

Here is the caller graph for this function:


Member Function Documentation

def multiprocessing.pool.MapResult._set (   self,
  i,
  success_result 
) [private]

Reimplemented from multiprocessing.pool.ApplyResult.

Definition at line 586 of file pool.py.

00586 
00587     def _set(self, i, success_result):
00588         success, result = success_result
00589         if success:
00590             self._value[i*self._chunksize:(i+1)*self._chunksize] = result
00591             self._number_left -= 1
00592             if self._number_left == 0:
00593                 if self._callback:
00594                     self._callback(self._value)
00595                 del self._cache[self._job]
00596                 self._cond.acquire()
00597                 try:
00598                     self._ready = True
00599                     self._cond.notify()
00600                 finally:
00601                     self._cond.release()
00602         else:
00603             self._success = False
00604             self._value = result
00605             if self._error_callback:
00606                 self._error_callback(self._value)
00607             del self._cache[self._job]
00608             self._cond.acquire()
00609             try:
00610                 self._ready = True
00611                 self._cond.notify()
00612             finally:
00613                 self._cond.release()
00614 
00615 #
00616 # Class whose instances are returned by `Pool.imap()`
00617 #

Here is the caller graph for this function:

def multiprocessing.pool.ApplyResult.get (   self,
  timeout = None 
) [inherited]

Definition at line 545 of file pool.py.

00545 
00546     def get(self, timeout=None):
00547         self.wait(timeout)
00548         if not self._ready:
00549             raise TimeoutError
00550         if self._success:
00551             return self._value
00552         else:
00553             raise self._value

Here is the call graph for this function:

Here is the caller graph for this function:

def multiprocessing.pool.ApplyResult.ready (   self) [inherited]

Definition at line 530 of file pool.py.

00530 
00531     def ready(self):
00532         return self._ready

def multiprocessing.pool.ApplyResult.successful (   self) [inherited]

Definition at line 533 of file pool.py.

00533 
00534     def successful(self):
00535         assert self._ready
00536         return self._success

def multiprocessing.pool.ApplyResult.wait (   self,
  timeout = None 
) [inherited]

Definition at line 537 of file pool.py.

00537 
00538     def wait(self, timeout=None):
00539         self._cond.acquire()
00540         try:
00541             if not self._ready:
00542                 self._cond.wait(timeout)
00543         finally:
00544             self._cond.release()

Here is the caller graph for this function:


Member Data Documentation

Definition at line 579 of file pool.py.

Definition at line 581 of file pool.py.

Reimplemented from multiprocessing.pool.ApplyResult.

Definition at line 582 of file pool.py.

Definition at line 577 of file pool.py.

Reimplemented from multiprocessing.pool.ApplyResult.

Definition at line 578 of file pool.py.

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: