| # Gaudi Framework, version v20r4
Generated: 8 Jan 2009

# GaudiPython::Parallel::Task Class Reference

List of all members.

## 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 66 of file Parallel.py.

## 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

## Member Function Documentation

def GaudiPython::Parallel::Task::__new__ | ( |  | cls,
|  |  | args,
|  |  | kwargs |
| ) |  |  |

Definition at line 71 of file Parallel.py.

    00071                                       :
    00072     task = object.__new__( cls, *args, **kwargs )
    00073     task.output = ()
    00074     task.environ = {}
    00075     for k,v in os.environ.items(): task.environ[k] = v
    00076     task.cwd = os.getcwd()
    00077     return task
      def initializeLocal(self):

def GaudiPython::Parallel::Task::initializeLocal | ( |  | self | ) |

Definition at line 78 of file Parallel.py.

    00078                            :
    00079     pass
      def initializeRemote(self):

def GaudiPython::Parallel::Task::initializeRemote | ( |  | self | ) |

Definition at line 80 of file Parallel.py.

    00080                             :
    00081     pass
      def process(self, item):

def GaudiPython::Parallel::Task::process | ( |  | self,
|  |  | item |
| ) |  |  |

Definition at line 82 of file Parallel.py.

    00082                          :
    00083     pass
      def finalize(self) :

def GaudiPython::Parallel::Task::finalize | ( |  | self | ) |

Definition at line 84 of file Parallel.py.

    00084                      :
    00085     pass
      def _mergeResults(self, result) :

def GaudiPython::Parallel::Task::_mergeResults | ( |  | self,
|  |  | result |
| ) |  |  | `[private]`

Definition at line 86 of file Parallel.py.

    00086                                   :
    00087    if type(result) is not type(self.output) :
    00088      raise TypeError("output type is not same as obtained result")
    00089    #--No iteratable---
    00090    if not hasattr( result , '__iter__' ):
    00091      if hasattr(self.output,'Add') : self.output.Add(result)
    00092      elif hasattr(self.output,'__iadd__') : self.output += result
    00093      elif hasattr(self.output,'__add__') : self.output = self.output + result
    00094      else : raise TypeError('result cannot be added')
    00095    #--Dictionary---
    00096    elif type(result) is dict :
    00097      if self.output.keys() <= result.keys(): minkeys = self.output.keys()
    00098      else: minkeys = result.keys()
    00099      for key in result.keys() :
    00100        if key in self.output :
    00101          if hasattr(self.output[key],'Add') : self.output[key].Add(result[key])
    00102          elif hasattr(self.output[key],'__iadd__') : self.output[key] += result[key]
    00103          elif hasattr(self.output[key],'__add__') : self.output[key] = self.output[key] + result[key]
    00104          else : raise TypeError('result cannot be added')
    00105        else :
    00106          self.output[key] = result[key]
    00107    #--Anything else (list)
    00108    else :
    00109      for i in range( min( len(self.output) , len(result)) ):
    00110        if hasattr(self.output[i],'Add') : self.output[i].Add(result[i])
    00111        elif hasattr(self.output[i],'__iadd__') : self.output[i] += result[i]
    00112        elif hasattr(self.output[i],'__add__') : self.output[i] = self.output[i] + result[i]
    00113        else : raise TypeError('result cannot be added')
      def _resetOutput(self):

def GaudiPython::Parallel::Task::_resetOutput | ( |  | self | ) | `[private]`

Definition at line 114 of file Parallel.py.

    00114                         :
    00115     output =  (type(self.output) is dict) and self.output.values() or self.output
    00116     for o in output :
    00117       if hasattr(o, 'Reset'): o.Reset()
    00118
    00119
    class WorkManager(object) :

## Member Data Documentation

GaudiPython::Parallel::Task::_initializeDone = False`[static, private]`

Definition at line 70 of file Parallel.py.

GaudiPython::Parallel::Task::output

Definition at line 93 of file Parallel.py.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r4/GaudiPython/python/GaudiPython/Parallel.py