ATLAS Offline Software
Classes | Functions | Variables
python.PyComps Namespace Reference

Classes

class  DataProxyLoader
 
class  MpEvtLoopMgr
 
class  PyEvtFilter
 
class  PyReader
 
class  PySgDumper
 
class  PyStorePayloadMon
 
class  PyWriter
 

Functions

None setupEvtSelForSeekOps ()
 
int getChunkSize ()
 
def _gen_key_from_type (t)
 
def _decode_item_list (lst, msg)
 

Variables

string __doc__ = 'A set of python components for event filtering'
 
string __author__ = 'Sebastien Binet <binet@cern.ch>'
 
string __version__ = '$Revision: 298807 $'
 

Function Documentation

◆ _decode_item_list()

def python.PyComps._decode_item_list (   lst,
  msg 
)
private
helper function to decode a (python) item list of storegate keys

Definition at line 22 of file Event/PyDumper/python/PyComps.py.

22 def _decode_item_list(lst, msg):
23  """helper function to decode a (python) item list of storegate keys"""
24  items = None
25  if (lst is None or lst == '*'):
26  items = None
27  else:
28  if isinstance(lst, str):
29  lst = lst.split(',')
30  if isinstance (lst, (list,set,tuple)):
31  if any (map (lambda x: not isinstance(x, str), lst)):
32  msg.error ('you have to provide a list of sg-keys !')
33  msg.error ('got: %s', lst)
34  raise ValueError()
35  elif len(lst)==1 and lst[0] is None or lst[0] == '*':
36  return None
37  items = []
38  for i in lst:
39  if isinstance(i, str) and i.count('#')==1:
40  item = i.split('#')
41  if item[1] == '*':
42  err = 'sorry, wildcards for keys are NOT (yet?) supported'
43  msg.error(err)
44  raise ValueError(err)
45  items.append(item)
46  elif isinstance(i, str) and i.count('#')==0:
47  # (type, key)
48  items.append ((None, i))
49  elif (isinstance(i, tuple) and len(i)==2 and
50  isinstance(i[0], str) and
51  isinstance(i[1], str)):
52  # (type, key)
53  items.append(i)
54  elif (isinstance(i, tuple) and len(i)==1 and
55  isinstance(i[0], str)):
56  # (type, key)
57  items.append ((None, i))
58  else:
59  err = 'invalid item format: %s'%i
60  msg.error(err)
61  raise ValueError(err)
62  return items
63 

◆ _gen_key_from_type()

def python.PyComps._gen_key_from_type (   t)
private

Definition at line 18 of file Event/PyDumper/python/PyComps.py.

18 def _gen_key_from_type(t):
19  "helper function to generate a storegate key from a typename"
20  return 'pyathena_tests__%s__key' % t
21 

◆ getChunkSize()

int python.PyComps.getChunkSize ( )

Definition at line 171 of file Control/AthenaMP/python/PyComps.py.

171 def getChunkSize() -> int :
172  from .AthenaMPFlags import jobproperties as jp
173  from PyUtils.MetaReaderPeeker import metadata
174  chunk_size = 1
175  if (jp.AthenaMPFlags.ChunkSize() > 0):
176  chunk_size = jp.AthenaMPFlags.ChunkSize()
177  msg.info('Chunk size set to %i', chunk_size)
178  elif metadata['file_size'] is not None:
179  #Don't use auto flush for shared reader
180  if (jp.AthenaMPFlags.UseSharedReader()):
181  msg.info('Shared Reader in use, chunk_size set to default (%i)', chunk_size)
182  #Use auto flush only if file is compressed with LZMA, else use default chunk_size
183  elif (jp.AthenaMPFlags.ChunkSize() == -1):
184  if (metadata['file_comp_alg'] == 2):
185  chunk_size = metadata['auto_flush']
186  msg.info('Chunk size set to auto flush (%i)', chunk_size)
187  else:
188  msg.info('LZMA algorithm not in use, chunk_size set to default (%i)', chunk_size)
189  #Use auto flush only if file is compressed with LZMA or ZLIB, else use default chunk_size
190  elif (jp.AthenaMPFlags.ChunkSize() == -2):
191  if (metadata['file_comp_alg'] == 1 or metadata['file_comp_alg'] == 2):
192  chunk_size = metadata['auto_flush']
193  msg.info('Chunk size set to auto flush (%i)', chunk_size)
194  else:
195  msg.info('LZMA nor ZLIB in use, chunk_size set to default (%i)', chunk_size)
196  #Use auto flush only if file is compressed with LZMA, ZLIB or LZ4, else use default chunk_size
197  elif (jp.AthenaMPFlags.ChunkSize() == -3):
198  if (metadata['file_comp_alg'] == 1 or metadata['file_comp_alg'] == 2 or metadata['file_comp_alg'] == 4):
199  chunk_size = metadata['auto_flush']
200  msg.info('Chunk size set to auto flush (%i)', chunk_size)
201  else:
202  msg.info('LZMA, ZLIB nor LZ4 in use, chunk_size set to (%i)', chunk_size)
203  #Use auto flush value for chunk_size, regarldess of compression algorithm
204  elif (jp.AthenaMPFlags.ChunkSize() <= -4):
205  chunk_size = metadata['auto_flush']
206  msg.info('Chunk size set to auto flush (%i)', chunk_size)
207  else:
208  msg.warning('Invalid ChunkSize, Chunk Size set to default (%i)', chunk_size)
209 
210  return chunk_size

◆ setupEvtSelForSeekOps()

None python.PyComps.setupEvtSelForSeekOps ( )
try to install seek-stuff on the EventSelector side 

Definition at line 134 of file Control/AthenaMP/python/PyComps.py.

134 def setupEvtSelForSeekOps() -> None:
135  """ try to install seek-stuff on the EventSelector side """
136  #import sys
137  #from AthenaCommon.Logging import log as msg
138  msg.debug("setupEvtSelForSeekOps:")
139  if 'AthenaRootComps.ReadAthenaRoot' in sys.modules:
140  # athenarootcomps has seeking enabled by default
141  msg.info('=> Seeking enabled.')
142  return
143 
144  if 'AthenaPoolCnvSvc.ReadAthenaPool' not in sys.modules:
145 
146  msg.info( "Cannot enable 'seeking' b/c module "
147  "[AthenaPoolCnvSvc.ReadAthenaPool] hasn't been imported..." )
148  msg.info( "Modify your jobOptions to import that module "
149  "(or just ignore this message)" )
150  return
151 
152  from AthenaCommon.AppMgr import theApp, AthAppMgr
153  if theApp.state() != AthAppMgr.State.OFFLINE:
154  msg.info( "C++ ApplicationMgr already instantiated, probably seeking "
155  "will be ill-configured..." )
156  msg.info( "EventSelector writers should implement updateHandlers" )
157 
158  from AthenaCommon.AppMgr import ServiceMgr as svcMgr
159  from AthenaCommon.Configurable import Configurable
160  collectionType = svcMgr.EventSelector.properties()["CollectionType"]
161 
162  if collectionType in ( "ImplicitROOT", Configurable.propertyNoValue, ):
163  msg.info ( "=> Seeking enabled." )
164 
165  else:
166  msg.warning( "Input seeking is not compatible with collection type of %s",
167  svcMgr.EventSelector.properties()["CollectionType"] )
168  msg.warning( "=> Seeking disabled." )
169  return
170 

Variable Documentation

◆ __author__

string python.PyComps.__author__ = 'Sebastien Binet <binet@cern.ch>'
private

Definition at line 8 of file Control/GaudiSequencer/python/PyComps.py.

◆ __doc__

string python.PyComps.__doc__ = 'A set of python components for event filtering'
private

Definition at line 7 of file Control/GaudiSequencer/python/PyComps.py.

◆ __version__

string python.PyComps.__version__ = '$Revision: 298807 $'
private
python.PyComps.getChunkSize
int getChunkSize()
Definition: Control/AthenaMP/python/PyComps.py:171
Configurable
athena/gaudi ----------------------------------------------------------—
python.PyComps.setupEvtSelForSeekOps
None setupEvtSelForSeekOps()
Definition: Control/AthenaMP/python/PyComps.py:134
python.PyComps._decode_item_list
def _decode_item_list(lst, msg)
Definition: Event/PyDumper/python/PyComps.py:22
python.PyComps._gen_key_from_type
def _gen_key_from_type(t)
Definition: Event/PyDumper/python/PyComps.py:18