#NEWLINE# def _download_range( self , bucket , key , filename , part_size , num_parts , extra_args , callback , part_index ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# range_param = self . _calculate_range_param ( part_size , part_index , num_parts ) #NEWLINE# max_attempts = self . _config . num_download_attempts #NEWLINE# last_exception = None #NEWLINE# for i in range ( max_attempts ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# logger . debug ( 'Making get_object call.' ) #NEWLINE# response = self . _client . get_object ( Bucket = bucket , Key = key , Range = range_param , ** extra_args ) #NEWLINE# streaming_body = StreamReaderProgress ( response [ 'Body' ] , callback ) #NEWLINE# buffer_size = ( 1024 * 16 ) #NEWLINE# current_index = ( part_size * part_index ) #NEWLINE# for chunk in iter ( ( lambda : streaming_body . read ( buffer_size ) ) , b'' ) : #NEWLINE# #INDENT# self . _ioqueue . put ( ( current_index , chunk ) ) #NEWLINE# current_index += len ( chunk ) #NEWLINE# #UNINDENT# return #NEWLINE# #UNINDENT# except S3_RETRYABLE_ERRORS as e : #NEWLINE# #INDENT# logger . debug ( 'Retrying exception caught (%s), retrying request, (attempt %s / %s)' , e , i , max_attempts , exc_info = True ) #NEWLINE# last_exception = e #NEWLINE# continue #NEWLINE# #UNINDENT# #UNINDENT# raise RetriesExceededError ( last_exception ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# logger . debug ( 'EXITING _download_range for part: %s' , part_index )