Replace usage of 'retrying' with 'tenacity'

Bug #1635399 reported by Boden R
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.messaging
Fix Released
Undecided
Gevorg Davoian

Bug Description

Today a number of OpenStack projects use the 'retrying' library [1] for generic retry behavior. While retrying provides a functional API, its author no longer actively maintains the repo and hasn't responded to numerous PRs, emails, etc. (more discussion in [2]). As a result, we can't push fixes/features to retrying to support various initiatives such as [3].

A fellow stacker graciously forked the retrying repo and revamped it's API to provide greater functionality/pluggablility; called tenacity [4]. While tenacity provides the same functionality as retrying, it has some notable differences such as:
- Tenacity uses seconds rather than ms as retrying did.
- Tenacity has different kwargs for the decorator and
Retrying class itself.
- Tenacity has a different approach for retrying args by
using classes for its stop/wait/retry kwargs.
- By default tenacity raises a RetryError if a retried callable
times out; retrying raises the last exception from the callable.
Tenacity provides backwards compatibility here by offering
the 'reraise' kwarg.
- Tenacity defines 'time.sleep' as a default value for a kwarg.
That said consumers who need to mock patch time.sleep
need to account for this via mocking of time.sleep before
tenacity is imported.
- For retries that check a result, tenacity will raise if the retried
function raises, whereas retrying retried on all exceptions.

We'd like to move from retrying to tenacity and eventually remove retrying from global requirements all together.

For projects using retrying, the move to tenacity (hopefully) isn't overly intrusive, but must take the above differences into consideration.

While I'm working to move all affected projects [6] from retrying to tenacity, this effort is a work in progress (under [5]).

[1] https://github.com/rholder/retrying
[2] https://review.openstack.org/#/c/321867/
[3] http://lists.openstack.org/pipermail/openstack-dev/2016-April/092914.html
[4] https://github.com/jd/tenacity
[5] https://review.openstack.org/#/q/message:%22Replace+retrying+with+tenacity%22
[6] http://codesearch.openstack.org/?q=retrying&i=nope&files=.*.txt&repos=

Changed in oslo.messaging:
assignee: nobody → Gevorg Davoian (gdavoian)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.messaging (master)

Fix proposed to branch: master
Review: https://review.openstack.org/389729

Changed in oslo.messaging:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.messaging (master)

Reviewed: https://review.openstack.org/389729
Committed: https://git.openstack.org/cgit/openstack/oslo.messaging/commit/?id=90125aa885a8a09bba71595699d937d8a3c23ba4
Submitter: Jenkins
Branch: master

commit 90125aa885a8a09bba71595699d937d8a3c23ba4
Author: Gevorg Davoian <email address hidden>
Date: Fri Oct 21 17:18:55 2016 +0300

    Replace retrying with tenacity

    This patch replaces the legacy retrying library with the newer
    and more convenient tenacity one, taking into account that:
    1) retrying uses milliseconds for wait times, but tenacity uses seconds;
    2) retrying has a lot of numeric arguments for specifying behaviour
    of decorated functions, while tenacity has a few of them, which are
    specialized objects, thus making the retry-decorator more flexible.

    Change-Id: Ib6ecffe5d1cf292badbb9eb6db6260f17460f343
    Closes-Bug: #1635399

Changed in oslo.messaging:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.messaging 5.13.0

This issue was fixed in the openstack/oslo.messaging 5.13.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.