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

Classes

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

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

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