Answer the question
In order to leave comments, you need to log in
Why does an error occur when executing a task in Celery (django)?
Django + Celery + redis
Two errors occur
when starting Celery
[2019-05-07 18:22:53,012: WARNING/MainProcess] /home/django/venv/lib/python3.5/site-packages/celery/app/control.py:54: DuplicateNodenameWarning: Received multiple replies from node name: [email protected]
Please make sure you give each node a unique nodename using
the celery worker `-n` option.
pluralize(len(dupes), 'name'), ', '.join(sorted(dupes)),
>>> asd.delay()
<AsyncResult: 4df07451-f474-405b-92e2-6b604191998c>
[2019-05-07 18:22:57,733: ERROR/MainProcess] Received unregistered task of type 'bot.tasks.asd'.
The message has been ignored and discarded.
Did you remember to import the module containing this task?
Or maybe you're using relative imports?
Please see
docs.celeryq.org/en/latest/internals/protocol.html
for more information.
The full contents of the message body was:
b'[[], {}, {"errbacks": null, "callbacks": null, "chain": null, "chord": null}]' (77b)
Traceback ( most recent call last):
File "/home/django/venv/lib/python3.5/site-packages/celery/worker/consumer/consumer.py", line 559,
[2019-05-07 18:43:26,645: INFO/ForkPoolWorker-1] Task bot.tasks.asd[f6c131b4-dea7-4b67-a49c-bd7adb0158bc] succeeded in 0.0036388610024005175s: 100
from __future__ import absolute_import, unicode_literals
from celery import task
@task
def asd():
return (100)
# Some other code
Answer the question
In order to leave comments, you need to log in
app = Celery('app', broker='redis://localhost:6379/1',
backend='redis://localhost:6379/1', include=['app.tasks'])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question