ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.RunDependentMCTaskIterator.taskIterator Class Reference
Inheritance diagram for python.RunDependentMCTaskIterator.taskIterator:
Collaboration diagram for python.RunDependentMCTaskIterator.taskIterator:

Public Member Functions

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

Public Attributes

 step
 
 taskit
 
 offset
 
 current
 
 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.

Constructor & Destructor Documentation

◆ __init__()

def 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 

Member Function Documentation

◆ __eq__()

def 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__()

def python.RunDependentMCTaskIterator.taskIterator.__iter__ (   self)

Definition at line 126 of file RunDependentMCTaskIterator.py.

126  def __iter__(self):
127  return self
128 

◆ __next__()

def 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 

◆ __repr__()

def 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

Definition at line 113 of file RunDependentMCTaskIterator.py.

◆ donejob

python.RunDependentMCTaskIterator.taskIterator.donejob

Definition at line 114 of file RunDependentMCTaskIterator.py.

◆ offset

python.RunDependentMCTaskIterator.taskIterator.offset

Definition at line 112 of file RunDependentMCTaskIterator.py.

◆ step

python.RunDependentMCTaskIterator.taskIterator.step

Definition at line 110 of file RunDependentMCTaskIterator.py.

◆ taskit

python.RunDependentMCTaskIterator.taskIterator.taskit

Definition at line 111 of file RunDependentMCTaskIterator.py.


The documentation for this class was generated from the following file:
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
python.Bindings.__iter__
__iter__
Definition: Control/AthenaPython/python/Bindings.py:791
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
calibdata.copy
bool copy
Definition: calibdata.py:27
WriteBchToCool.update
update
Definition: WriteBchToCool.py:67