Reputation: 835
Celery tasks have on_success handler and task-success signal. what is the difference?
Upvotes: 2
Views: 3302
Reputation: 6162
As stated in the docs:
Abstract classes are not registered, but are used as the base class for new task types.
So apparently handlers are methods that you can override to do something. You can see example of custom handler after_return
in the docs actually:
from celery import Task
class DebugTask(Task):
abstract = True
def after_return(self, *args, **kwargs):
print('Task returned: {0!r}'.format(self.request)
Signals are means of decoupling, so you can make your code listening from outside for some event to happen and act appropriately.
Upvotes: 2