AWS retries upon throttling errors

Hi everybody,

I’ve seen a number of Ansible module PRs lately which add retries upon throttling errors, and some have been done in different ways. For example, I just submitted https://github.com/ansible/ansible-modules-core/pull/3379 which uses a decorator method to enable easy retries. Another approach is in https://github.com/ansible/ansible-modules-core/pull/2968 in which you pass in the function and arguments to a separate function which handles the retries for you.

With the first method (i.e., a decorator), I think it’s syntactically prettier when you want to retry your own methods, but it’s a little uglier to retry just raw AWS calls (since you can’t use the @ decorator syntax on boto methods). With the second method, it’s a little uglier, but consistent across everything. I’m fairly ambivalent between the two.

Regardless of which method people think is better, I think that it would be good to just have a standardized way of doing this, probably implemented as a method in module_utils.ec2, that people could call. Brian Coca said he was working on an experimental branch, but it looks to have since been deleted.

What do you all think of putting something like this in module_utils.ec2?

–Joel

Thank you for bringing this up and I personally prefer to use a decorator. I was getting ready to write one for the module PR’s that I have in place as I have hit the issue the other day as well. +1 for decorator