I have been looking at a few test flakes in Python SDK recently, and some
of them can benefit from a simple retry logic. See PR #7455  for an
example[1].

I would not recommend retrying by default for all tests, or mechanically
adding a retry to every test that we see flaking: some legitimate bugs may
manifest in flakes that happen rarely, and a retry logic will hide them
from us.

However, in some tests we can consider adding retries, retries with a
back-off or retries only on particular exceptions. tenacity[2] offers
several decorators for this purpose. It is available under Apache 2.0
license on PyPi [3], and is being maintained.

What does the community think about adding this library as a test-only
dependency to Python SDK?

Thanks,
Valentyn

[1] https://github.com/apache/beam/pull/7455
[2] https://github.com/jd/tenacity
[3] https://pypi.org/project/tenacity/

Reply via email to