Update tenacity version and usage
Some tenacity apis now get a single retry_state parameter which contain all the previous information. Change-Id: I8c83c21fe424bd6884a8e61893f1bda22dc7787b
This commit is contained in:
parent
eee5406118
commit
7cdfb5175b
@ -25,7 +25,7 @@ six==1.10.0
|
|||||||
sphinx==1.6.5
|
sphinx==1.6.5
|
||||||
stestr==1.0.0
|
stestr==1.0.0
|
||||||
tempest==17.1.0
|
tempest==17.1.0
|
||||||
tenacity==4.9.0
|
tenacity==5.0.1
|
||||||
testresources==2.0.0
|
testresources==2.0.0
|
||||||
testtools==2.2.0
|
testtools==2.2.0
|
||||||
testscenarios==0.4
|
testscenarios==0.4
|
||||||
|
@ -7,7 +7,7 @@ pbr>=4.0.0 # Apache-2.0
|
|||||||
decorator>=4.3.0 # BSD
|
decorator>=4.3.0 # BSD
|
||||||
eventlet>=0.24.1 # MIT
|
eventlet>=0.24.1 # MIT
|
||||||
netaddr>=0.7.18 # BSD
|
netaddr>=0.7.18 # BSD
|
||||||
tenacity>=4.9.0 # Apache-2.0
|
tenacity>=5.0.1 # Apache-2.0
|
||||||
six>=1.10.0 # MIT
|
six>=1.10.0 # MIT
|
||||||
oslo.i18n>=3.15.3 # Apache-2.0
|
oslo.i18n>=3.15.3 # Apache-2.0
|
||||||
oslo.log>=3.36.0 # Apache-2.0
|
oslo.log>=3.36.0 # Apache-2.0
|
||||||
|
@ -128,12 +128,14 @@ def update_v3_tags(current_tags, tags_update):
|
|||||||
return tags
|
return tags
|
||||||
|
|
||||||
|
|
||||||
def _log_before_retry(func, trial_number):
|
def _log_before_retry(retry_state):
|
||||||
"""Before call strategy that logs to some logger the attempt."""
|
"""Before call strategy that logs to some logger the attempt."""
|
||||||
if trial_number > 1:
|
if retry_state.attempt_number > 1:
|
||||||
LOG.warning("Retrying call to '%(func)s' for the %(num)s time",
|
LOG.warning("Retrying call to '%(func)s' for the %(num)s time",
|
||||||
{'func': tenacity_utils.get_callback_name(func),
|
{'func': tenacity_utils.get_callback_name(
|
||||||
'num': tenacity_utils.to_ordinal(trial_number)})
|
retry_state.fn),
|
||||||
|
'num': tenacity_utils.to_ordinal(
|
||||||
|
retry_state.attempt_number)})
|
||||||
|
|
||||||
|
|
||||||
def _get_args_from_frame(frames, frame_num):
|
def _get_args_from_frame(frames, frame_num):
|
||||||
@ -145,7 +147,7 @@ def _get_args_from_frame(frames, frame_num):
|
|||||||
return formated_args
|
return formated_args
|
||||||
|
|
||||||
|
|
||||||
def _log_after_retry(func, trial_number, trial_time_taken):
|
def _log_after_retry(retry_state):
|
||||||
"""After call strategy that logs to some logger the finished attempt."""
|
"""After call strategy that logs to some logger the finished attempt."""
|
||||||
# Using inspect to get arguments of the relevant call
|
# Using inspect to get arguments of the relevant call
|
||||||
frames = inspect.trace()
|
frames = inspect.trace()
|
||||||
@ -158,9 +160,9 @@ def _log_after_retry(func, trial_number, trial_time_taken):
|
|||||||
|
|
||||||
LOG.warning("Finished retry of %(func)s for the %(num)s time after "
|
LOG.warning("Finished retry of %(func)s for the %(num)s time after "
|
||||||
"%(time)0.3f(s) with args: %(args)s",
|
"%(time)0.3f(s) with args: %(args)s",
|
||||||
{'func': tenacity_utils.get_callback_name(func),
|
{'func': tenacity_utils.get_callback_name(retry_state.fn),
|
||||||
'num': tenacity_utils.to_ordinal(trial_number),
|
'num': tenacity_utils.to_ordinal(retry_state.attempt_number),
|
||||||
'time': trial_time_taken,
|
'time': retry_state.seconds_since_start,
|
||||||
'args': formated_args})
|
'args': formated_args})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user