Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for wrap_func #29

Open
flaper87 opened this issue Nov 26, 2014 · 1 comment
Open

Add support for wrap_func #29

flaper87 opened this issue Nov 26, 2014 · 1 comment

Comments

@flaper87
Copy link

If we run out of attempts, it'd be nice to have a final chance to inspect the result of the call before the final reraise or return are done. I think this could be done by having a wrap_func called passing in the attempt

@gulducat
Copy link

gulducat commented May 2, 2018

Just in case someone stumbles across this (like I did), I made a change to tenacity (after seeing #65) that covers this.

from tenacity import retry, stop_after_attempt

def inspect_last_attempt(last_attempt):
    print(dir(last_attempt))
    # do whatever you might like to do here

@retry(stop=stop_after_attempt(3), retry_error_callback=inspect_last_attempt)
def aw_shucks():
    raise Exception('aw dang')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants