Celery & Uplink with SIGUSR1 Signal #273
Unanswered
mark-barrett
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there!
I had a query about using Uplink with Celery. Specifically around Time Limits:
https://docs.celeryq.dev/en/stable/userguide/workers.html#time-limits
In a Celery task, I can set a hard and soft limit, whereby when the soft limit is reached, Celery will raise a SoftTimeLimitExceeded exception so that a handler can do some last minute cleanup before the task exits.
When I write a simple task like this:
Everything works as expected and the Soft Limit Exception is thrown.
However if I put an Uplink call into the try block, Celery indicates that a Soft Limit has been reached but the except never gets run.
I did some digging and found that Celery interrupts the worker and then raises the exception by using a
signal
(SIGUSR1
):celery/celery#3878 (comment)
If you look at that issue, you can see that the same issue arose and the reason for it was because
libpq C
(psycopg2
) doesn't react to Python signals. They mentioned a way to overcome that in the issue.I know that under the hood Uplink uses
requests
, so I tried to imitate the same request with it instead, to at least see if it was a requests problem.When I use a simple:
response = requests.post('some_url', json=some_dict)
It works fine and the exception is still thrown.
So I'm wondering three things:
Perhaps I'm missing something else, but any feedback would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions