def _transfer_data(src, dest, length, chunk_size):
 chunks = int(math.ceil((length / chunk_size)))
 remaining_length = length
 LOG.debug('%(chunks)s chunks of %(bytes)s bytes to be transferred.', {'chunks': chunks, 'bytes': chunk_size})
 for chunk in range(0, chunks):
  before = time.time()
  data = tpool.execute(src.read, min(chunk_size, remaining_length))
  if (data == ''):
   break
  tpool.execute(dest.write, data)
  remaining_length -= len(data)
  delta = (time.time() - before)
  rate = ((chunk_size / delta) / units.Ki)
  LOG.debug('Transferred chunk %(chunk)s of %(chunks)s (%(rate)dK/s).', {'chunk': (chunk + 1), 'chunks': chunks, 'rate': rate})
  eventlet.sleep(0)
 tpool.execute(dest.flush)

def _transfer_data ( src , dest , length , chunk_size ) : chunks = int ( math . ceil ( ( length / chunk_size ) ) ) remaining_length = length LOG . debug ( '%(chunks)s chunks of %(bytes)s bytes to be transferred.' , { 'chunks' : chunks , 'bytes' : chunk_size } ) for chunk in range ( 0 , chunks ) : before = time . time ( ) data = tpool . execute ( src . read , min ( chunk_size , remaining_length ) ) if ( data == '' ) : break tpool . execute ( dest . write , data ) remaining_length -= len ( data ) delta = ( time . time ( ) - before ) rate = ( ( chunk_size / delta ) / units . Ki ) LOG . debug ( 'Transferred chunk %(chunk)s of %(chunks)s (%(rate)dK/s).' , { 'chunk' : ( chunk + 1 ) , 'chunks' : chunks , 'rate' : rate } ) eventlet . sleep ( 0 ) tpool . execute ( dest . flush )
transfer data between files .