def retry_until_ok(func, *args, **kwargs):
 count = 0
 while True:
  try:
   return func(*args, **kwargs)
  except RuntimeError:
   raise
  except Exception:
   count += 1
   if (count > 120):
    LOG.exception('Call to %s failed too many times in retry_until_ok', func)
    raise
   time.sleep(1)

def retry_until_ok ( func , * args , ** kwargs ) : count = 0 while True : try : return func ( * args , ** kwargs ) except RuntimeError : raise except Exception : count += 1 if ( count > 120 ) : LOG . exception ( 'Call to %s failed too many times in retry_until_ok' , func ) raise time . sleep ( 1 )
retry code block until it succeeds .