Backoff: Python function decorators for configurable backoff and retry
1–4 of 4 posts
Re: Backoff: Python function decorators for configurable backoff and retry
#2Cool. If I were maintaining build/deploy nonsense written using Python, this could be quite helpful. A lot of the build/deploy stuff I maintain is -alas- written as Groovy scripts for Jenkins, and I've hand-rolled a similar, simpler wrapper construct. It started up being used to place, and now it's probably used in a dozen places throughout various build, test and deploy scripts.
Usage:
retry_unreliable(3){
sh "essential_but_unreliable_thing --failure-probability 0.01"
}
Definition: def retry_unreliable(int max_attempts, Closure func) {
def error = null
assert max_attempts > 0
def delay_initial = 8.0f
def delay_multiplier = 2.0f
def delay = delay_initial
for (attempt = 0; attempt
Sometimes doing something like this isn't necessarily the right course of action -- e.g. if an external service you depend on is struggling to reply to your requests because of load, hammering it with additional requests when it starts to fail isn't the right solution. But quite a lot of time ladling on stupid retry logic turns an irritating rare failure case into a non-issue.Re: Backoff: Python function decorators for configurable backoff and retry
#3Seems very similar to the riprova library. I've found it very useful for asyncio web scrapers.
http://riprova.readthedocs.io/en/latest/ https://github.com/h2non/riprova
Re: Backoff: Python function decorators for configurable backoff and retry
#4Same as https://pypi.python.org/pypi/retry no?