Django / celery - celery status: error: no nodes responded over time

I am trying to deploy a simple celery example on my production server, I followed the tutorial on the celery website about starting celery as a daemon http://docs.celeryproject.org/en/latest/tutorials/daemonizing.html#daemonizing , and I got the configuration file in / etc / default / celeryd

   1 # Name of nodes to start
   2 # here we have a single node
   3 CELERYD_NODES = "w1"
   4 # or we could have three nodes:
   5 # CELERYD_NODES = "w1 w2 w3"
   6 
   7 # Where to chdir at start.
   8 CELERYD_CHDIR = "/ home / audiwime / cidec_sw"
   nine 
  10 # Python interpreter from environment.
  11 ENV_PYTHON = "/ usr / bin / python26"
  12 
  13 # How to call "manage.py celeryd_multi"
  14 CELERYD_MULTI = "$ ENV_PYTHON $ CELERYD_CHDIR / manage.py celeryd_multi"
  fifteen 
  16 # # How to call "manage.py celeryctl"
  17 CELERYCTL = "$ ENV_PYTHON $ CELERYD_CHDIR / manage.py celeryctl"
  eighteen 
  19 # Extra arguments to celeryd
  20 CELERYD_OPTS = "- time-limit = 300 --concurrency = 8"
  21 
  22 # Name of the celery config module.
  23 CELERY_CONFIG_MODULE = "celeryconfig"
  24 
  25 #% n will be replaced with the nodename.
  26 CELERYD_LOG_FILE = "/ var / log / celery /% n.log"
  27 CELERYD_PID_FILE = "/ var / run / celery /% n.pid"
  28 
  29 # Workers should run as an unprivileged user.
  30 CELERYD_USER = "audiwime"
  31 CELERYD_GROUP = "audiwime"
  32 
  33 export DJANGO_SETTINGS_MODULE = "cidec_sw.settings"

but if i run

  celery status 

in the terminal, I got this answer:

  Error: No nodes replied within time constraint 

I can restart the celery through the celeryd script provided at https://github.com/celery/celery/tree/3.0/extra/generic-init.d/

 /etc/init.d/celeryd restart
 celeryd-multi v3.0.12 (Chiastic Slide)
 > w1.one.cloudwime.com: DOWN
 > Restarting node w1.one.cloudwime.com: OK

I can run

  python26 manage.py celeryd -l info 

and my tasks in django work fine, but if I let the daemons do my work, I won’t get any results, not even errors in /var/log/celery/w1.log

I know that my task was registered because I did it

from celery import current_app def call_celery_delay(request): print current_app.tasks run.delay(request.GET['age']) return HttpResponse(content="celery task set",content_type="text/html") 

and I get a dictionary in which my task appears

 {'celery.chain': <@task: celery.chain>, 'celery.chunks': <@task: celery.chunks>, 'celery.chord': <@task: celery.chord>, 'tasks.add2': <@task: tasks.add2>, 'celery.chord_unlock': <@task: celery.chord_unlock>, **'tareas.tasks.run': <@task: tareas.tasks.run>**, 'tareas.tasks.add': <@task: tareas.tasks.add>, 'tareas.tasks.test_two_minute': <@task: tareas.tasks.test_two_minute>, 'celery.backend_cleanup': <@task: celery.backend_cleanup>, 'celery.map': <@task: celery.map>, 'celery.group': <@task: celery.group>, 'tareas.tasks.test_one_minute': <@task: tareas.tasks.test_one_minute>, 'celery.starmap': <@task: celery.starmap>} 

but also, I get nothing, no result from my task, errors in the logs, nothing. Can someone tell me what could be wrong? You are my only hope ...

+8
python django celery django-celery
source share
3 answers

I solved my problem, it was a very simple solution, but it was also weird: I did this:

 $ /etc/init.d/celerybeat restart $ /etc/init.d/celeryd restart $ service celeryd restart 

I had to do this in this order, otherwise I would get an ugly error: no node responded over time.

-one
source share

Use the following command to find the problem:

 C_FAKEFORK=1 sh -x /etc/init.d/celeryd start 

This usually happens because there are problems in the original project (problems with permissions, syntax error, etc.).

As mentioned in celery docs: -

If the worker starts with β€œOK”, but exits almost immediately after that and there is nothing in the log file, then there is probably an error, but since the standard outputs of the daemon are already closed, you will not be able to see them anywhere. For this situation, you can use the C_FAKEFORK environment variable to skip the demonstration step.

Luck

Source: Celery Papers

+1
source share

because the celery daemon cannot be started. This is one of the reasons. So kindly restart it using python manage.py celeryd --loglevel = INFO

0
source share

All Articles