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

Allow retrying more than GET #266

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hexylena
Copy link
Member

@hexylena hexylena commented Aug 6, 2018

extracted retry logic from _get into a retry method.

  • untested (even locally) just want to discuss implementation
  • should retry be _retry?
  • renames existing methods. Should the old names be retained as 'legacy' API? Should they include a deprecation notice somehow?

xref galaxyproject/ephemeris#98 (comment)

@nuwang
Copy link
Member

nuwang commented Aug 6, 2018

@erasche Nice! Perhaps the tenacity library could be used to simplify implementation?: https://github.com/jd/tenacity

@hexylena
Copy link
Member Author

hexylena commented Aug 6, 2018

@nuwang I'm fond of https://github.com/litl/backoff for that as well.

Currently this just retains the existing implementation of retrying as it did not seem worth it to me to add a new dependency for this when the existing GET retrying logic works OK. But if that is preferred for bioblend's maintenance, we can certainly swap it for a library.

I worry that it would only eliminate maybe 5-10 lines, I am under the impression we still need to retain the logic for setting the maximum values as client object attributes (not sure how that plays with decorators, never tried changing the definition of a decorator by using a variable set at runtime rather than hardcoded values,) and we still need to retain the behaviour of checking the exit code and attempting json conversion if requested

@nuwang
Copy link
Member

nuwang commented Aug 6, 2018

backoff looks great! Don't think I've come across it before.

Sure, makes sense if a lot of (future) variation in the retrying logic isn't expected. Calling the decorator manually with dynamic parameters is doable, but I guess it depends on what it buys, which may not be that much. I only suggested it because we've been using it in CloudBridge for some similar operations, and the library (we originally used retrying) has been fairly stable over time.

@hexylena
Copy link
Member Author

hexylena commented Aug 6, 2018

It's a good suggestion! I personally prefer retry libraries for this since you can do nicer things like exponential backoff. Maybe @nsoranzo has an opinion when he's back from vacation

@nsoranzo
Copy link
Member

@erasche Can you take a look at the failing tests on Travis?

@hexylena
Copy link
Member Author

@nsoranzo

untested (even locally) just want to discuss implementation

I didn't update any of the tests until I got your OK on the implementation. If you're happy with that I'll go ahead and fix the tests.

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

Successfully merging this pull request may close these issues.

3 participants