Replace retrying with tenacity

We are replacing all usages of the 'retrying' package with
'tenacity' as the author of retrying is not actively maintaining
the project. Tenacity is a fork of retrying, but has improved the
interface and extensibility (see [1] for more details). Our end
goal here is removing the retrying package from our requirements.

[1] https://github.com/jd/tenacity

Change-Id: I660192549918b9cd9738810cbfaf3dc4456f97fa
Story: #1635390
Task: #40647
This commit is contained in:
Riccardo Pittau 2020-08-11 15:14:49 +02:00
parent 2c38173fbf
commit f4648facf7
3 changed files with 7 additions and 6 deletions

View File

@ -18,7 +18,7 @@ import netaddr
import openstack
from openstack import exceptions as os_exc
from oslo_config import cfg
import retrying
import tenacity
from ironic_inspector.common.i18n import _
from ironic_inspector.common import keystone
@ -187,9 +187,11 @@ def get_node(node_id, ironic=None, **kwargs):
return node
@retrying.retry(
retry_on_exception=lambda exc: isinstance(exc, os_exc.SDKException),
stop_max_attempt_number=5, wait_fixed=1000)
@tenacity.retry(
retry=tenacity.retry_if_exception_type(os_exc.SDKException),
stop=tenacity.stop_after_attempt(5),
wait=tenacity.wait_fixed(1),
reraise=True)
def call_with_retries(func, *args, **kwargs):
"""Call an ironic client function retrying all errors.

View File

@ -100,7 +100,6 @@ repoze.lru==0.7
requests==2.23.0
requestsexceptions==1.4.0
restructuredtext-lint==1.3.0
retrying==1.2.3
rfc3986==1.4.0
Routes==2.4.1
six==1.14.0

View File

@ -29,7 +29,7 @@ oslo.rootwrap>=5.8.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
oslo.service!=1.28.1,>=1.24.0 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
retrying!=1.3.0,>=1.2.3 # Apache-2.0
tenacity>=6.2.0 # Apache-2.0
stevedore>=1.20.0 # Apache-2.0
SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT
tooz>=1.64.0 # Apache-2.0