thorn icon indicating copy to clipboard operation
thorn copied to clipboard

Enable callback functions for the Celery dispatcher

Open moiseshiraldo opened this issue 7 years ago • 1 comments

The on_success, on_error and on_timeout callbacks are really useful (e.g. I intend to use them to store/show recent webhook deliveries to the customers, same way GitHub does).

I think it would be safe to enable them for the celery dispatcher if we look at Python's what can be pickled list:

  • functions defined at the top level of a module
  • built-in functions defined at the top level of a module
  • classes that are defined at the top level of a module
  • instances of such classes whose dict or the result of calling getstate() is picklable

I've done it myself and it's working fine, I've also fixed the corresponding tests (see the commit below). Would you consider merging the branch?

Thank you for your work!

moiseshiraldo avatar Feb 06 '17 16:02 moiseshiraldo

@moiseshiraldo could you elaborate on how you are using the on_success, on_error and on_timeout callbacks in code? I'm having trouble figuring out where I put these callbacks using ModelEvents and celery dispatcher.

saevarom avatar Feb 09 '21 13:02 saevarom