GaudiMP::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 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
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
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
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 |
) |
|
| def GaudiMP::Parallel::Task::initializeLocal |
( |
|
self |
) |
|
| def GaudiMP::Parallel::Task::initializeRemote |
( |
|
self |
) |
|
| def GaudiMP::Parallel::Task::process |
( |
|
self, |
|
|
|
item | |
|
) |
| | |
Member Data Documentation
The documentation for this class was generated from the following file:
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r0/GaudiMP/python/GaudiMP/Parallel.py