-
-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RetryError cannot be serialized with pickle #182
Comments
This is causing me headaches too. It makes tenacity not usable with celery. |
I still have this issue using tenacity==7.0.0 and celery==4.4.7 from celery import shared_task
from tenacity import (
retry,
retry_if_exception_type,
stop_after_attempt,
)
@retry(
retry=retry_if_exception_type(ValueError), stop=stop_after_attempt(1),
)
def foo():
raise ValueError()
@shared_task()
def test_exp():
foo() Calling this task results in
|
sergei-maertens
added a commit
to open-formulieren/open-forms
that referenced
this issue
Apr 8, 2024
The retry error from tenacity uses threading locks under the hood, which cannot be pickled. Specifying reraise=True avoids this particular codepath. See upstream issues: * jd/tenacity#429 * jd/tenacity#182 * jd/tenacity#147
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, RetryError is unpickleable. To ensure that exceptions raised from the tenacity library are pickle-able they should provide the original arguments it was instantiated with in its .args attribute.This affects the ability to use tenacity inside of a celery task for example. I am working on a PR for this issue.
The text was updated successfully, but these errors were encountered: