I'm using celery-once to make sure some tasks are only run one at a time. The lock is acquired in apply_async and released in after_return.
When I use the CeleryIntegration I'm not seeing any of the locks being released after the task has finished running. I'm not very familiar with the inner workings of celery, but any ideas what's going on?
Do you see this bug in Raven-Python? Raven uses official Celery hooks while this SDK aggressively (for lack of a better word) monkeypatches Celery to capture exceptions happening in hooks, and to work around some bugs in Celery 3.
I think I've narrowed it down to an issue with celery-once. The library uses the task name and call arguments from the run method (using `inspect.getcallargs) to generate the lock key. It generates the key both when acquiring and releasing the lock. It seems the arguments before and after the task gets patched are slightly different (the wrapper takes in optional args).
I don't think this is strictly an issue with the SDK, so I'll close this for now, thanks for looking at it though.
@mumumumu if it's a missing functools.wraps somewhere we can fix it in the SDK as well, no big deal
Thanks @untitaker, that'd be much appreciated. Adding a @wraps(f) to the _wrap_task_call _inner function does fix the issue for me.
We should do this everywhere then. Monkeypatches are quite inconsistent across the codebase.
Since this is blocking you I'll just get a minimal fix out of the door.
Proper wrapping will likely take more effort (possibly using wrapt instead of functools).