Reputation: 395
I have used celery signals it is working fine
@shared_task(name="execute_task")
def execute(*args,**kwargs):
return 2+2
@task_success.connect
def task_success_handler(sender=None, headers=None, body=None, **kwargs):
print(pass)
After the execute task is executed the task success signal is called, but I want to disable this call. Is it achievable?
Upvotes: 1
Views: 486
Reputation: 146
Yes we can do this, celery signals also come with disconnect feature, so what you need to do is
from celery import signals
@shared_task(name="execute_task")
def execute(*args,**kwargs):
signals.task_success.disconnect(task_success_handler)
return 2+2
This way the success function won't be called.
Upvotes: 4