Replace usage of 'retrying' with 'tenacity'

Bug #1635393 reported by Boden R
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Shared File Systems Service (Manila)
Fix Released
High
Boden R

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 manila:
assignee: nobody → Boden R (boden)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on manila (master)

Change abandoned by boden (<email address hidden>) on branch: master
Review: https://review.openstack.org/380552

Revision history for this message
Jason Grosso (jgrosso) wrote :

Hello is this issue still occurring? It looks like the change was abandoned is this actively be addressed by anyone?

Revision history for this message
Boden R (boden) wrote :

This wasn't a bug per se, but rather a note that projects were using a stale dependency.
If manila isn't using tenacity already, likely they are using an old/stale version of retrying.

Revision history for this message
Jason Grosso (jgrosso) wrote :

Thanks I will checking with the community to see what is going on!

Revision history for this message
Tom Barron (tpb) wrote :

Boden, is there a reason that you abandoned https://review.openstack.org/380552 ?

Tom Barron (tpb)
Changed in manila:
importance: Undecided → Low
Vida Haririan (vhariria)
Changed in manila:
importance: Low → Wishlist
Revision history for this message
Vida Haririan (vhariria) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to manila (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/manila/+/801911

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to manila (master)

Reviewed: https://review.opendev.org/c/openstack/manila/+/801911
Committed: https://opendev.org/openstack/manila/commit/903aab19204e3982293d615eb87ed35ae1817d34
Submitter: "Zuul (22348)"
Branch: master

commit 903aab19204e3982293d615eb87ed35ae1817d34
Author: ashrod98 <email address hidden>
Date: Thu Aug 26 20:43:05 2021 +0000

    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.

    Tenacity provides the same functionality as retrying, but has the
    following major differences to account for:
    - Tenacity uses seconds rather than ms as retrying did
      (the retry interface in manila exposed time in seconds as well)
    - 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 - we are going to set this in the retry interface
    by default.
    - For retries that check a result, tenacity will raise if the
    retried function raises, whereas retrying retried on all
    exceptions - we haven't exposed this in the retry interface.

    This patch updates all usages of retrying with tenacity.
    Unit tests are added where applicable.

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

    Co-Authored-By: boden <email address hidden>
    Co-Authored-By: Goutham Pacha Ravi <email address hidden>
    Closes-Bug: #1635393
    Change-Id: Ia0c3fa5cd82356a33becbf57444f3db5ffbb0dd0
    Signed-off-by: Goutham Pacha Ravi <email address hidden>

Changed in manila:
status: In Progress → Fix Released
Changed in manila:
milestone: none → xena-3
importance: Wishlist → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/manila 13.0.0.0rc1

This issue was fixed in the openstack/manila 13.0.0.0rc1 release candidate.

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.