| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes | List of all members
GaudiMP.Parallel.Task Class Reference
Inheritance diagram for GaudiMP.Parallel.Task:
[legend]
Collaboration diagram for GaudiMP.Parallel.Task:
[legend]

## Public Member Functions
def | __new__ (cls, args, kwargs)
def | initializeLocal (self)
def | initializeRemote (self)
def | process (self, item)
def | finalize (self)

## Public Attributes
| output

## Private Member Functions
def | _mergeResults (self, result)
def | _resetOutput (self)

## Static Private Attributes
bool | _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.

52 def __new__ ( cls, *args, **kwargs ):
53 task = object.__new__( cls )
54 task.output = ()
55 task.environ = {}
56 for k,v in os.environ.items(): task.environ[k] = v
57 task.cwd = os.getcwd()
58 return task
GaudiMP.Parallel.Task.__new__
def __new__(cls, args, kwargs)
Definition: Parallel.py:52

def GaudiMP.Parallel.Task._mergeResults | ( |  | self,
|  |  | result
| ) |  |
| private

Definition at line 67 of file Parallel.py.

67 def _mergeResults(self, result) :
68 if type(result) is not type(self.output) :
69 raise TypeError("output type is not same as obtained result")
70 #--No iteratable---
71 if not hasattr( result , '__iter__' ):
72 if hasattr(self.output,'Add') : self.output.Add(result)
73 elif hasattr(self.output,'__iadd__') : self.output += result
74 elif hasattr(self.output,'__add__') : self.output = self.output + result
75 else : raise TypeError('result cannot be added')
76 #--Dictionary---
77 elif type(result) is dict :
78 if self.output.keys() <= result.keys(): minkeys = self.output.keys()
79 else: minkeys = result.keys()
80 for key in result.keys() :
81 if key in self.output :
82 if hasattr(self.output[key],'Add') : self.output[key].Add(result[key])
83 elif hasattr(self.output[key],'__iadd__') : self.output[key] += result[key]
84 elif hasattr(self.output[key],'__add__') : self.output[key] = self.output[key] + result[key]
85 else : raise TypeError('result cannot be added')
86 else :
87 self.output[key] = result[key]
88 #--Anything else (list)
89 else :
90 for i in range( min( len(self.output) , len(result)) ):
91 if hasattr(self.output[i],'Add') : self.output[i].Add(result[i])
92 elif hasattr(self.output[i],'__iadd__') : self.output[i] += result[i]
93 elif hasattr(self.output[i],'__add__') : self.output[i] = self.output[i] + result[i]
94 else : raise TypeError('result cannot be added')
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:57
GaudiMP.Parallel.Task.output
output
Definition: Parallel.py:74
gaudirun.type
type
Definition: gaudirun.py:125
GaudiMP.Parallel.Task._mergeResults
def _mergeResults(self, result)
Definition: Parallel.py:67

def GaudiMP.Parallel.Task._resetOutput | ( |  | self | ) |
| private

Definition at line 95 of file Parallel.py.

95 def _resetOutput(self):
96 output = (type(self.output) is dict) and self.output.values() or self.output
97 for o in output :
98 if hasattr(o, 'Reset'): o.Reset()
99
100
GaudiMP.Parallel.Task.output
output
Definition: Parallel.py:74
gaudirun.type
type
Definition: gaudirun.py:125
GaudiMP.Parallel.Task._resetOutput
def _resetOutput(self)
Definition: Parallel.py:95

def GaudiMP.Parallel.Task.finalize | ( |  | self | ) |

Definition at line 65 of file Parallel.py.

65 def finalize(self) :
66 pass
GaudiMP.Parallel.Task.finalize
def finalize(self)
Definition: Parallel.py:65

def GaudiMP.Parallel.Task.initializeLocal | ( |  | self | ) |

Definition at line 59 of file Parallel.py.

59 def initializeLocal(self):
60 pass
GaudiMP.Parallel.Task.initializeLocal
def initializeLocal(self)
Definition: Parallel.py:59

def GaudiMP.Parallel.Task.initializeRemote | ( |  | self | ) |

Definition at line 61 of file Parallel.py.

61 def initializeRemote(self):
62 pass
GaudiMP.Parallel.Task.initializeRemote
def initializeRemote(self)
Definition: Parallel.py:61

def GaudiMP.Parallel.Task.process | ( |  | self,
|  |  | item
| ) |  |

Definition at line 63 of file Parallel.py.

63 def process(self, item):
64 pass
GaudiMP.Parallel.Task.process
def process(self, item)
Definition: Parallel.py:63

## Member Data Documentation

bool GaudiMP.Parallel.Task._initializeDone = False
| static private

Definition at line 51 of file Parallel.py.

GaudiMP.Parallel.Task.output

Definition at line 74 of file Parallel.py.

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

- GaudiMP/python/GaudiMP/Parallel.py