135def getChunkSize() -> int :
136 from .AthenaMPFlags import jobproperties as jp
137 from PyUtils.MetaReaderPeeker import metadata
138 chunk_size = 1
139
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
145 if (jp.AthenaMPFlags.UseSharedReader()):
146 msg.info('Shared Reader in use, chunk_size set to default (%i)', chunk_size)
147
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
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
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
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