Running celery as a daemon does not create a PID file

I crossed my brains with this from the last few days, I saw other problems in stackoverflow (since this is a duplicate question), and I tried everything to make this work, the workers work fine, but celery doesn't start as a process.

I ran the command:

sudo service celeryd start 

and I get:

 celery init v10.1. Using config script: /etc/default/celeryd celery multi v3.1.23 (Cipater) > Starting nodes... > worker1@ip-172-31-21-215 : OK 

I run:

 sudo service celeryd status 

and I get:

 celery init v10.1. Using config script: /etc/default/celeryd celeryd down: no pidfiles found 

celeryd down: no pidfiles found error is what i need to solve.

I know this question is a duplicate, but still combined with me on this because I tried them all and still could not solve it.

I am deploying this script on Amazon web services. I am using a virtual environment.

init.d script is taken directly from here , and then I gave it the necessary permissions.

Here is my configuration file:

 # Names of nodes to start # most people will only start one node: CELERYD_NODES="worker1" # but you can also start multiple and configure settings # for each in CELERYD_OPTS (see `celery multi --help` for examples): #CELERYD_NODES="worker1 worker2 worker3" # alternatively, you can specify the number of nodes to start: #CELERYD_NODES=10 # Absolute or relative path to the 'celery' command: # CELERY_BIN="/usr/local/bin/celery" CELERY_BIN="/home/<user>/.virtualenvs/<virtualenv_name>/bin/celery" # App instance to use # comment out this line if you don't use an app # CELERY_APP="proj" # or fully qualified: CELERY_APP="<project_name>.settings:app" # Where to chdir at start. CELERYD_CHDIR="/home/<user>/projects/<project_name>/" # Extra command-line arguments to the worker CELERYD_OPTS="--time-limit=300 --concurrency=8" # %N will be replaced with the first part of 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. # You need to create this user manually (or you can choose # a user/group combination that already exists, eg nobody). CELERYD_USER="celery" CELERYD_GROUP="celery" # If enabled pid and log directories will be created if missing, # and owned by the userid/group configured. CELERY_CREATE_DIRS=1 

I used this process to create a celery user using this article.

My project is a Django project, and I specified the DJANGO_SETTINGS_MODULE environment DJANGO_SETTINGS_MODULE in the celery settings file, as indicated in the documentation and also in the stackoverflow file.

Do I need to change something in the init.d script file or something else that needs to be added to the celery configuration file ... This concerns the celery user that I created, because I also tried to specify

 CELERYD_USER = "" CELERYD_GROUP = "" 

and also changing the value of DEFAULT_USER to "" in the init.d script. Nevertheless, the problem continued.

One answer also said that there might be some errors in the project ... but I did not find such errors in all tests.

PS: I indicated, and for privacy issues, they have their original names.

+6
source share
2 answers

I saw the same problem and it turned out to be a permission problem. Make sure that the user / group that the celery runs on belongs to / var / log / celery / and / var / run / celery / folders. See Here Step By Step: Picking Celery

0
source

I had a problem, and I solved it only now, thank God! For me, this is a matter of resolution. I expected it to be in / var / run / celery or / var / log / celery, but it turned out to be a log file for which I set up an entry in Django. For some reason, celery wanted to write to this file (I have to look at it), but had no permission. I found the error using the verbose command and skip the demon demo:

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

This is an old thread, but if any of you come across this error, I hope this can help!

Good luck

0
source

All Articles