ATLAS Offline Software
Loading...
Searching...
No Matches
python.PyComps Namespace Reference

Classes

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

Functions

int getChunkSize ()
 _gen_key_from_type (t)
 _decode_item_list (lst, msg)

Variables

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

Function Documentation

◆ _decode_item_list()

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

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

22def _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()

python.PyComps._gen_key_from_type ( t)
protected

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

18def _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 131 of file Control/AthenaMP/python/PyComps.py.

131def getChunkSize() -> int :
132 from .AthenaMPFlags import jobproperties as jp
133 from PyUtils.MetaReaderPeeker import metadata
134 chunk_size = 1
135 # In jobs without input (e.g. event generation), metadata is an empty dictionary
136 if (jp.AthenaMPFlags.ChunkSize() > 0):
137 chunk_size = jp.AthenaMPFlags.ChunkSize()
138 msg.info('Chunk size set to %i', chunk_size)
139 elif 'file_size' in metadata and metadata['file_size'] is not None:
140 #Don't use auto flush for shared reader
141 if (jp.AthenaMPFlags.UseSharedReader()):
142 msg.info('Shared Reader in use, chunk_size set to default (%i)', chunk_size)
143 #Use auto flush only if file is compressed with LZMA, else use default chunk_size
144 elif (jp.AthenaMPFlags.ChunkSize() == -1):
145 if (metadata['file_comp_alg'] == 2):
146 chunk_size = metadata['auto_flush']
147 msg.info('Chunk size set to auto flush (%i)', chunk_size)
148 else:
149 msg.info('LZMA algorithm not in use, chunk_size set to default (%i)', chunk_size)
150 #Use auto flush only if file is compressed with LZMA or ZLIB, else use default chunk_size
151 elif (jp.AthenaMPFlags.ChunkSize() == -2):
152 if (metadata['file_comp_alg'] == 1 or metadata['file_comp_alg'] == 2):
153 chunk_size = metadata['auto_flush']
154 msg.info('Chunk size set to auto flush (%i)', chunk_size)
155 else:
156 msg.info('LZMA nor ZLIB in use, chunk_size set to default (%i)', chunk_size)
157 #Use auto flush only if file is compressed with LZMA, ZLIB or LZ4, else use default chunk_size
158 elif (jp.AthenaMPFlags.ChunkSize() == -3):
159 if (metadata['file_comp_alg'] == 1 or metadata['file_comp_alg'] == 2 or metadata['file_comp_alg'] == 4):
160 chunk_size = metadata['auto_flush']
161 msg.info('Chunk size set to auto flush (%i)', chunk_size)
162 else:
163 msg.info('LZMA, ZLIB nor LZ4 in use, chunk_size set to (%i)', chunk_size)
164 #Use auto flush value for chunk_size, regarldess of compression algorithm
165 elif (jp.AthenaMPFlags.ChunkSize() <= -4):
166 chunk_size = metadata['auto_flush']
167 msg.info('Chunk size set to auto flush (%i)', chunk_size)
168 else:
169 msg.warning('Invalid ChunkSize, Chunk Size set to default (%i)', chunk_size)
170
171 return chunk_size

Variable Documentation

◆ __author__

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

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

◆ __doc__

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

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

◆ __version__

str python.PyComps.__version__ = '$Revision: 1.11 $'
private

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