Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rabbitmq celeryd celerybeat not executing tasks in production as Daemon

Last week I setup RabbitMQ and Celery on my production system after having tested it on my local dev and all worked fine.

I get the feeling that my tasks are not being executed on production since I have about 1200 tasks that are still in the queue.

I run a CentOS 5.4 setup, with celeryd and celerybeat daemons and WSGI I have made the import onto the wsgi module.

When I run, /etc/init.d/celeryd start I get the following response

[root@myvm myproject]# /etc/init.d/celeryd start
celeryd-multi v2.3.1
> Starting nodes...
    > w1.myvm.centos01: OK

When I run /etc/init.d/celerybeat start I get the following response

[root@myvm fundedmyprojectbyme]# /etc/init.d/celerybeat start
Starting celerybeat...

So by the output it seems that the items are executed successully - although when looking at the queues they only seem to get more than getting executed.

Now if I perform the same execution, but use django's manage.py instead ./manage.py celeryd and ./manage.py celerybeat the tasks immediately start to get processed.

My /etc/default/celeryd

# Where to chdir at start.
CELERYD_CHDIR="/www/myproject/"

# How to call "manage.py celeryd_multi"
CELERYD_MULTI="$CELERYD_CHDIR/manage.py celeryd_multi"

# Extra arguments to celeryd
CELERYD_OPTS="--time-limit=300 --concurrency=8"

# Name of the celery config module.
CELERY_CONFIG_MODULE="celeryconfig"

# %n will be replaced with the nodename.
CELERYD_LOG_FILE="/var/log/celery/%n.log"
CELERYD_PID_FILE="/var/run/celery/%n.pid"

# Workers should run as an unprivileged user.
CELERYD_USER="celery"
CELERYD_GROUP="celery"

# Name of the projects settings module.
export DJANGO_SETTINGS_MODULE="settings"

my /etc/default/celerybeat

# Where the Django project is.
CELERYD_CHDIR="/www/myproject/"

# Name of the projects settings module.
export DJANGO_SETTINGS_MODULE="settings"

# Path to celeryd
CELERYD="/www/myproject/manage.py celeryd"

# Path to celerybeat
CELERYBEAT="/www/myproject/manage.py celerybeat"

# Extra arguments to celerybeat
CELERYBEAT_OPTS="--schedule=/var/run/celerybeat-schedule"

my /etc/init.d files for /celeryd and /celerybeat are based on the generic scripts

Am I missing a part of the configuration???

like image 997
ApPeL Avatar asked Nov 13 '22 17:11

ApPeL


1 Answers

I ran into a situation once where I have to add 'python' as a prefix to the CELERYD_MULTI variable.

# How to call "manage.py celeryd_multi"
CELERYD_MULTI="python $CELERYD_CHDIR/manage.py celeryd_multi"

For whatever reason, my manage.py script would not execute normally (even though I had chmod +x and configured my shebang's properly.) You might try this to see if it works.

like image 116
Peter Kirby Avatar answered Dec 28 '22 20:12

Peter Kirby