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

Classes

class  DataProxyLoader
 
class  MpEvtLoopMgr
 
class  PyEvtFilter
 
class  PyReader
 
class  PySgDumper
 
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: 1.11 $'
 

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 172 of file Control/AthenaMP/python/PyComps.py.

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

◆ setupEvtSelForSeekOps()

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

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

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

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: 1.11 $'
private

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

python.PyComps.getChunkSize
int getChunkSize()
Definition: Control/AthenaMP/python/PyComps.py:172
Configurable
athena/gaudi ----------------------------------------------------------—
python.PyComps.setupEvtSelForSeekOps
None setupEvtSelForSeekOps()
Definition: Control/AthenaMP/python/PyComps.py:135
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