from my_celery import app
from delete_duplicate import DeleteDuplicate
import celery
class CallbackTask(celery.Task):
def on_success(self, retval, task_id, args, kwargs):
print "Task id: ", task_id
print "retval ", retval
print "Args ", args
print "kwargs: ", kwargs
def on_failure(self, exc, task_id, args, kwargs, einfo):
print('{0!r} failed: {1!r}'.format(task_id, exc))
class Ott(object):
@app.task(base=CallbackTask())
def delete_duplicate_ott():
print "Inside ott.... "
DeleteDuplicate().delete_duplicate_ott()
@app.task(base=CallbackTask())
def delete_duplicate_noti():
print "Inside noti.... "
DeleteDuplicate().delete_duplicate_noti()
I used Callback in celery to implement above callback.
Above code is working perfectly. I want to pass parameters in on_success() and on_failure() callbacks in args or kwargs. Args and Kwargs both print None after successful execution of task.
I search on internet, din't find any solution which follow these kind of call back using inheritance(sub class).
Any help is highly appreciated. Thanks!