Skip to content

Conversation

@maingoh
Copy link
Contributor

@maingoh maingoh commented Aug 2, 2019

Related to #17

  • Retries on http errors (bad status code and requests exceptions)
  • Fast retry, with small timeout on most requests
  • Allow to override the default from a specific endpoint: network creation doesn't retry as it is an heavy request, we don't want to retry silently. Request timeout is longer
  • Allow to customize the retryer when instanciating the client

@maingoh
Copy link
Contributor Author

maingoh commented Aug 2, 2019

@maingoh maingoh requested a review from thomas-riccardi August 2, 2019 17:20
Copy link
Contributor

@vdel vdel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way of implementing the retry forces the developer to remember wrapping its function call into a retry. The problem is that when new developers come and do not do that, we will still miss the retry.

I would rather implement the retry at the low-level in make_request, forwarding retry parameters from the generic retrieve, list, etc... mixups in order to keep the possibility to locally change the retry behavior.

@maingoh
Copy link
Contributor Author

maingoh commented Aug 19, 2019

I dont' understand the problem. The retry is already located in make_request. No need for the developer to change anything. Doing it at the urllib3 level was also considered but doesn't provide as much flexibility as tenacity does (see with @thomas-riccardi). We are also not sure it retries on everything we want.

Overriding the retry parameter from each endpoint is a feature we can probably add. Though for now I don't see a use case where it would be necessary ? This can be done in another PR if really needed one day, but I don't think it provides a lot of value to do it now.

@vdel
Copy link
Contributor

vdel commented Aug 20, 2019

I would rather implement the retry at the low-level in make_request, forwarding retry parameters from the generic retrieve, list, etc... mixups in order to keep the possibility to locally change the retry behavior.

I was referring to places like this one: https://github.com/Deepomatic/deepomatic-client-python/pull/58/files#diff-e63474de88f64ad351a531418838acc4R126 but I didn't see that the retry condition was different from a failure. So actually this comment above is void and everything looks good for me.

@maingoh
Copy link
Contributor Author

maingoh commented Aug 20, 2019

I think I understand what you meant. I could have merged the retry policy of the task with the http helper retry policy instead of using two different retryer, but I don't know if it really make sense to merge the network failures with the retry on "pending" tasks. I don't think it is a big deal though ?

@thomas-riccardi
Copy link
Contributor

I think I understand what you meant. I could have merged the retry policy of the task with the http helper retry policy instead of using two different retryer, but I don't know if it really make sense to merge the network failures with the retry on "pending" tasks. I don't think it is a big deal though ?

Let's discuss it IRL; I am not sure what we want to do, what should be avoided (double level retry?)...

@vdel
Copy link
Contributor

vdel commented Aug 30, 2019

There is retry in case of error 5XX for example, then we use retry to poll on the task until it completes.
For me this is okay, it's an important feature so I'm in favor of taking a decision soonish to merge it.

if http_retry is not None:
return http_retry.retry(functor)

return functor()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I would move that in an else: it would then be at the same level as with the http_retry: much clearer IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is a matter of taste, I prefer when there is always a non indented return

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed; I was struggling with that and the early return: either both return in if/else, or only one return maybe?

if http_retry is not None:
    functor = functools.partial(http_retry.retry, functor)

maingoh and others added 6 commits September 25, 2019 10:25
Co-Authored-By: Thomas Riccardi <thomas@deepomatic.com>
Co-Authored-By: Thomas Riccardi <thomas@deepomatic.com>
Co-Authored-By: Thomas Riccardi <thomas@deepomatic.com>
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.

4 participants