utils.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:vmware-nsxlib 作者: openstack 项目源码 文件源码
def _log_after_retry(func, trial_number, trial_time_taken):
    """After call strategy that logs to some logger the finished attempt."""
    # Using inspect to get arguments of the relevant call
    frames = inspect.trace()
    # Look at frame #2 first because of the internal functions _do_X
    formated_args = _get_args_from_frame(frames, 2)
    if not formated_args:
        formated_args = _get_args_from_frame(frames, 1)
    if not formated_args:
        formated_args = "Unknown"

    LOG.warning("Finished retry of %(func)s for the %(num)s time after "
                "%(time)0.3f(s) with args: %(args)s",
                {'func': tenacity_utils.get_callback_name(func),
                 'num': tenacity_utils.to_ordinal(trial_number),
                 'time': trial_time_taken,
                 'args': formated_args})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号