131def getChunkSize() -> int :
132 from .AthenaMPFlags import jobproperties as jp
133 from PyUtils.MetaReaderPeeker import metadata
134 chunk_size = 1
135
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
141 if (jp.AthenaMPFlags.UseSharedReader()):
142 msg.info('Shared Reader in use, chunk_size set to default (%i)', chunk_size)
143
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
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
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
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