You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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