I'm using Django and Celery to communicate with RabbitMQ. I've registered all of the tasks, and put them in the CELERY_IMPORTS tuple in my settings file. When I run a task, I get the "not registered" error message.
# tail -f /var/log/celeryd.log
. logfile -> /var/log/celeryd.log@INFO
. events -> OFF
. beat -> OFF
. tasks ->
. apps.contact.tasks.emailContact
. apps.declaration.tasks.MailChimpSignup
. apps.questions.tasks.emailQuestionTask
. queued_storage.tasks.SaveToRemoteTask
[2010-10-19 17:53:44,958: INFO/PoolWorker-1] child process calling self.run()
[2010-10-19 17:53:44,971: WARNING/MainProcess] [email protected] has started.
[2010-10-19 17:54:03,962: ERROR/MainProcess] Unknown task ignored: "Task of kind 'apps.declaration.tasks.MailChimpSignup' is not registered, please make sure it's imported.": {'retries': 0, 'task': 'apps.declaration.tasks.MailChimpSignup', 'args': [], 'eta': None, 'kwargs': {'email': u'[email protected]'}, 'id': '919c6030-70b1-43e6-87f5-907fa0f52c08'}
Heres what my task definition looks like:
class MailChimpSignup(Task):
def run(self, email, **kwargs):
"""
This will register the declaration signer on mail chimp.
"""
logger = self.get_logger(**kwargs)
logger.info("Processed mailchimp signup for %s" % email)
chimp = chimpy.Connection(settings.MAILCHIMP_API_KEY)
try:
chimp.list_member_info(settings.MAILCHIMP_LIST_ID, email)
except ChimpyException:
try:
x = chimp.list_subscribe(
settings.MAILCHIMP_LIST_ID,
email,
{
# 'FNAME': self.first_name,
# 'LNAME': self.last_name,
},
email_type='HTML',
double_optin = False,
)
except ChimpyException:
return False
return True
tasks.register(MailChimpSignup)