def retry(ExceptionToCheck, tries=3, delay=3, backoff=2, logger=None):
    def deco_retry(f):
        def f_retry(*args, **kwargs):
            mtries, mdelay = tries, delay
            try_one_last_time = True
            while mtries > 1:
                try:
                    return f(*args, **kwargs)
                    try_one_last_time = False
                    break
                except ExceptionToCheck, e:
                    msg = "%s, Retrying in %d seconds..." % (str(e), mdelay)
                    if logger:
                        logger.warning(msg)
                    else:
                        print msg
                    time.sleep(mdelay)
                    mtries -= 1
                    mdelay *= backoff
            if try_one_last_time:
                return f(*args, **kwargs)
            return
        return f_retry  # true decorator
    return deco_retry
The model factory for this object.
dataset/ETHPy150Open opencolorado/OpenColorado-Tools-and-Utilities/Scripts/Harvest/Drcog/DrcogSync.py/retry--crossover with--dataset/ETHPy150Open mozilla/moztrap/tests/model/execution/api/test_runcaseversion.py/RunCaseVersionResourceTest.factory