ask/celery — Issue #500: task_sent signal does not get handled properly
Author: ankurchopra87
Created: 2011-10-11 15:39:42+00:00
State: open

I basically copy pasted the example from the docs (http://docs.celeryproject.org/en/latest/reference/celery.signals.html#task-sent)

from celery.signals import task_sent

def task_sent_handler(**kwargs):
print("Got signal task_sent with kwargs %s" % (str(kwargs) ))

task_sent.connect(task_sent_handler)

Now the handler is executed if i queue a task from within another task i.e a currently executing task queues another one ... but is not triggered for the first or only task (that i am queing from a django view).

Using Celery 2.3.3 with the following settings

CELERY_TRACK_STARTED = True
CELERY_RESULT_BACKEND = "cache"
CELERY_CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
CELERY_TASK_RESULT_EXPIRES = 300
CELERY_SEND_TASK_SENT_EVENT = True
CELERY_TASK_PUBLISH_RETRY_POLICY = True

Am i doing somthing wrong... i want to be able to obtain the task_id for each task when it is queued.