ATLAS Offline Software
Loading...
Searching...
No Matches
python.RunDependentMCTaskIterator.taskIterator Class Reference
Inheritance diagram for python.RunDependentMCTaskIterator.taskIterator:
Collaboration diagram for python.RunDependentMCTaskIterator.taskIterator:

Public Types

typedef HLT::TypeInformation::for_each_type_c< typenameEDMLIST::map, my_functor, my_result<>, my_arg< HLT::TypeInformation::get_cont, CONTAINER > >::type result

Public Member Functions

 __init__ (self, task, step)
 __eq__ (self, another)
 __iter__ (self)
 __repr__ (self)
 __next__ (self)

Public Attributes

 step = step
 taskit = itertools.cycle(task)
int offset = 0
 current = None
list donejob = []

Detailed Description

iterator over a list of dicts (the 'task'). Each dict must contain 'evts', optionally 'force_new'.

Definition at line 104 of file RunDependentMCTaskIterator.py.

Member Typedef Documentation

◆ result

Definition at line 90 of file EDM_MasterSearch.h.

Constructor & Destructor Documentation

◆ __init__()

python.RunDependentMCTaskIterator.taskIterator.__init__ ( self,
task,
step )
create the iterator from task (a list of dicts) and step (the max number of evts. per job)
the iterator 

Definition at line 107 of file RunDependentMCTaskIterator.py.

107 def __init__(self,task,step):
108 """create the iterator from task (a list of dicts) and step (the max number of evts. per job)
109 the iterator """
110 self.step = step
111 self.taskit = itertools.cycle(task)
112 self.offset = 0
113 self.current = None
114 self.donejob = []
115 try:
116 if min(e['evts'] for e in task) < 0: #py2.4
117 raise ValueError("Cannot use empty task lists or negative N(events).")
118 except KeyError:
119 raise ValueError("Cannot use tasks that don't always define 'evts':", task)
120 if (step < 1): raise ValueError("Cannot use step size smaller than 1 in a taskIterator.")
121 return
122
#define min(a, b)
Definition cfImp.cxx:40

Member Function Documentation

◆ __eq__()

python.RunDependentMCTaskIterator.taskIterator.__eq__ ( self,
another )

Definition at line 123 of file RunDependentMCTaskIterator.py.

123 def __eq__(self, another):
124 return (self.current == another.current) and (self.step == another.step)
125

◆ __iter__()

python.RunDependentMCTaskIterator.taskIterator.__iter__ ( self)

Definition at line 126 of file RunDependentMCTaskIterator.py.

126 def __iter__(self):
127 return self
128

◆ __next__()

python.RunDependentMCTaskIterator.taskIterator.__next__ ( self)

Definition at line 132 of file RunDependentMCTaskIterator.py.

132 def __next__(self):
133 self.donejob = []
134 if (self.current is None): self.current = next(self.taskit)
135 to_do = self.step
136 while True:
137 if (to_do == 0) : return self.offset, self.current
138 can_do = self.current['evts'] - self.offset
139 if ( can_do > to_do ) :
140 self.donejob.append( self.current.copy() )
141 self.donejob[-1].update({'evts':to_do})
142 self.offset += to_do
143 return self.offset, self.current
144 else:
145 to_do -= can_do
146 self.offset = 0
147 pass
148 self.donejob.append( self.current.copy() )
149 self.donejob[-1].update({'evts':can_do})
150 self.current = next(self.taskit)
151 if self.current.get('force_new',False): to_do = 0
152 raise StopIteration
153#
154
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130

◆ __repr__()

python.RunDependentMCTaskIterator.taskIterator.__repr__ ( self)

Definition at line 129 of file RunDependentMCTaskIterator.py.

129 def __repr__(self):
130 return "offset=%i; row=%i,%i" % (self.offset,self.current.get('run',0),self.current.get('lb',0))
131

Member Data Documentation

◆ current

python.RunDependentMCTaskIterator.taskIterator.current = None

Definition at line 113 of file RunDependentMCTaskIterator.py.

◆ donejob

list python.RunDependentMCTaskIterator.taskIterator.donejob = []

Definition at line 114 of file RunDependentMCTaskIterator.py.

◆ offset

python.RunDependentMCTaskIterator.taskIterator.offset = 0

Definition at line 112 of file RunDependentMCTaskIterator.py.

◆ step

python.RunDependentMCTaskIterator.taskIterator.step = step

Definition at line 110 of file RunDependentMCTaskIterator.py.

◆ taskit

python.RunDependentMCTaskIterator.taskIterator.taskit = itertools.cycle(task)

Definition at line 111 of file RunDependentMCTaskIterator.py.


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