132def getChunkSize() -> int :
133 from .AthenaMPFlags import jobproperties as jp
134 from PyUtils.MetaReaderPeeker import metadata
135 chunk_size = 1
136
137 if (jp.AthenaMPFlags.ChunkSize() > 0):
138 chunk_size = jp.AthenaMPFlags.ChunkSize()
139 msg.info('Chunk size set to %i', chunk_size)
140 elif 'file_size' in metadata and metadata['file_size'] is not None:
141
142 if (jp.AthenaMPFlags.UseSharedReader()):
143 msg.info('Shared Reader in use, chunk_size set to default (%i)', chunk_size)
144
145 elif (jp.AthenaMPFlags.ChunkSize() == -1):
146 if (metadata['file_comp_alg'] == 2):
147 chunk_size = metadata['auto_flush']
148 msg.info('Chunk size set to auto flush (%i)', chunk_size)
149 else:
150 msg.info('LZMA algorithm not in use, chunk_size set to default (%i)', chunk_size)
151
152 elif (jp.AthenaMPFlags.ChunkSize() == -2):
153 if (metadata['file_comp_alg'] == 1 or metadata['file_comp_alg'] == 2):
154 chunk_size = metadata['auto_flush']
155 msg.info('Chunk size set to auto flush (%i)', chunk_size)
156 else:
157 msg.info('LZMA nor ZLIB in use, chunk_size set to default (%i)', chunk_size)
158
159 elif (jp.AthenaMPFlags.ChunkSize() == -3):
160 if (metadata['file_comp_alg'] == 1 or metadata['file_comp_alg'] == 2 or metadata['file_comp_alg'] == 4):
161 chunk_size = metadata['auto_flush']
162 msg.info('Chunk size set to auto flush (%i)', chunk_size)
163 else:
164 msg.info('LZMA, ZLIB nor LZ4 in use, chunk_size set to (%i)', chunk_size)
165
166 elif (jp.AthenaMPFlags.ChunkSize() <= -4):
167 chunk_size = metadata['auto_flush']
168 msg.info('Chunk size set to auto flush (%i)', chunk_size)
169 else:
170 msg.warning('Invalid ChunkSize, Chunk Size set to default (%i)', chunk_size)
171
172 return chunk_size