Gaudi Framework, version v22r1

Home   Generated: Mon Feb 28 2011
Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes

GaudiMP::Parallel::Task Class Reference

List of all members.

Public Member Functions

def __new__
def initializeLocal
def initializeRemote
def process
def finalize

Public Attributes

 output

Private Member Functions

def _mergeResults
def _resetOutput

Static Private Attributes

 _initializeDone = False

Detailed Description

Basic base class to encapsulate any processing that is going to be porcessed in parallel.
    User class much inherit from it and implement the methods initializeLocal,
    initializeRemote, process and finalize.   

Definition at line 47 of file Parallel.py.


Member Function Documentation

def GaudiMP::Parallel::Task::__new__ (   cls,
  args,
  kwargs 
)

Definition at line 52 of file Parallel.py.

00053                                         :
00054         task = object.__new__( cls )
00055         task.output = ()
00056         task.environ = {}
00057         for k,v in os.environ.items(): task.environ[k] = v
00058         task.cwd = os.getcwd()
        return task
def GaudiMP::Parallel::Task::_mergeResults (   self,
  result 
) [private]

Definition at line 67 of file Parallel.py.

00068                                     :
00069         if type(result) is not type(self.output) :
00070             raise TypeError("output type is not same as obtained result")
00071         #--No iteratable---
00072         if not hasattr( result , '__iter__' ):
00073             if hasattr(self.output,'Add') : self.output.Add(result)
00074             elif hasattr(self.output,'__iadd__') : self.output += result
00075             elif hasattr(self.output,'__add__') : self.output = self.output + result
00076             else : raise TypeError('result cannot be added')
00077         #--Dictionary---
00078         elif type(result) is dict :
00079             if self.output.keys() <= result.keys(): minkeys = self.output.keys()
00080             else: minkeys = result.keys()
00081             for key in result.keys() :
00082                 if key in self.output :
00083                     if hasattr(self.output[key],'Add') : self.output[key].Add(result[key])
00084                     elif hasattr(self.output[key],'__iadd__') : self.output[key] += result[key]
00085                     elif hasattr(self.output[key],'__add__') : self.output[key] = self.output[key] + result[key]
00086                     else : raise TypeError('result cannot be added')
00087                 else :
00088                     self.output[key] = result[key]
00089         #--Anything else (list)
00090         else :
00091             for i in range( min( len(self.output) , len(result)) ):
00092                 if hasattr(self.output[i],'Add') : self.output[i].Add(result[i])
00093                 elif hasattr(self.output[i],'__iadd__') : self.output[i] += result[i]
00094                 elif hasattr(self.output[i],'__add__') : self.output[i] = self.output[i] + result[i]
                else : raise TypeError('result cannot be added')
def GaudiMP::Parallel::Task::_resetOutput (   self ) [private]

Definition at line 95 of file Parallel.py.

00096                           :
00097         output =  (type(self.output) is dict) and self.output.values() or self.output
00098         for o in output :
00099             if hasattr(o, 'Reset'): o.Reset()
00100 

def GaudiMP::Parallel::Task::finalize (   self )

Definition at line 65 of file Parallel.py.

00066                        :
        pass
def GaudiMP::Parallel::Task::initializeLocal (   self )

Definition at line 59 of file Parallel.py.

00060                              :
        pass
def GaudiMP::Parallel::Task::initializeRemote (   self )

Definition at line 61 of file Parallel.py.

00062                               :
        pass
def GaudiMP::Parallel::Task::process (   self,
  item 
)

Definition at line 63 of file Parallel.py.

00064                            :
        pass

Member Data Documentation

GaudiMP::Parallel::Task::_initializeDone = False [static, private]

Definition at line 51 of file Parallel.py.

Definition at line 67 of file Parallel.py.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Mon Feb 28 2011 18:28:44 for Gaudi Framework, version v22r1 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004