Replace retrying with tenacity
We are replacing all usages of the retrying package with tenacity with an end goal of removing the retrying package from our requirements. (Cherry picked from: Ie1b082848ac6153d29af7779de914071dc8c1ba5) Change-Id: I6b6c57e772723f41d8182a83d2efcc4afc6290a2
This commit is contained in:
parent
1eda9e1cdc
commit
6ee469e2f9
@ -7,7 +7,7 @@ pbr>=1.6 # Apache-2.0
|
|||||||
enum34;python_version=='2.7' or python_version=='2.6' or python_version=='3.3' # BSD
|
enum34;python_version=='2.7' or python_version=='2.6' or python_version=='3.3' # BSD
|
||||||
eventlet!=0.18.3,>=0.18.2 # MIT
|
eventlet!=0.18.3,>=0.18.2 # MIT
|
||||||
netaddr!=0.7.16,>=0.7.13 # BSD
|
netaddr!=0.7.16,>=0.7.13 # BSD
|
||||||
retrying!=1.3.0,>=1.2.3 # Apache-2.0
|
tenacity>=3.1.1 # Apache-2.0
|
||||||
six>=1.9.0 # MIT
|
six>=1.9.0 # MIT
|
||||||
neutron-lib>=0.4.0 # Apache-2.0
|
neutron-lib>=0.4.0 # Apache-2.0
|
||||||
oslo.i18n>=2.1.0 # Apache-2.0
|
oslo.i18n>=2.1.0 # Apache-2.0
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import retrying
|
import tenacity
|
||||||
|
|
||||||
from neutron_lib import exceptions
|
from neutron_lib import exceptions
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
@ -63,12 +63,13 @@ def update_v3_tags(current_tags, tags_update):
|
|||||||
return tags
|
return tags
|
||||||
|
|
||||||
|
|
||||||
def retry_upon_exception(exc, delay=500, max_delay=2000,
|
def retry_upon_exception(exc, delay=0.5, max_delay=2,
|
||||||
max_attempts=DEFAULT_MAX_ATTEMPTS):
|
max_attempts=DEFAULT_MAX_ATTEMPTS):
|
||||||
return retrying.retry(retry_on_exception=lambda e: isinstance(e, exc),
|
return tenacity.retry(reraise=True,
|
||||||
wait_exponential_multiplier=delay,
|
retry=tenacity.retry_if_exception_type(exc),
|
||||||
wait_exponential_max=max_delay,
|
wait=tenacity.wait_exponential(
|
||||||
stop_max_attempt_number=max_attempts)
|
multiplier=delay, max=max_delay),
|
||||||
|
stop=tenacity.stop_after_attempt(max_attempts))
|
||||||
|
|
||||||
|
|
||||||
def list_match(list1, list2):
|
def list_match(list1, list2):
|
||||||
|
Loading…
Reference in New Issue
Block a user