def refresh_lock(lock_file):
 unique_id = ('%s_%s_%s' % (os.getpid(), ''.join([str(random.randint(0, 9)) for i in range(10)]), hostname))
 try:
  with open(lock_file, 'w') as lock_write:
   lock_write.write((unique_id + '\n'))
 except Exception:
  while (get_lock.n_lock > 0):
   release_lock()
  _logger.warn('Refreshing lock failed, we release the lock before raising again the exception')
  raise
 return unique_id

def refresh_lock ( lock_file ) : unique_id = ( '%s_%s_%s' % ( os . getpid ( ) , '' . join ( [ str ( random . randint ( 0 , 9 ) ) for i in range ( 10 ) ] ) , hostname ) ) try : with open ( lock_file , 'w' ) as lock_write : lock_write . write ( ( unique_id + '\n' ) ) except Exception : while ( get_lock . n_lock > 0 ) : release_lock ( ) _logger . warn ( 'Refreshing lock failed, we release the lock before raising again the exception' ) raise return unique_id
refresh an existing lock by re-writing the file containing the owners unique id .