I’ve been developing a Django application and I am now trying to add Celery for background tasks. I need both normal tasks and periodic tasks to be queued. I can start up celeryd just fine, and execute tasks with it (I start it with the command python manage.py celeryd start --settings=settings --loglevel=INFO
).
On Windows you can’t do -beat
/-b
to enable beat mode; you need to start celerybeat as a separate service (this is stated in the FAQ section of the Celery docs). If I type this into the command line — python manage.py celerybeat -s djcelery.schedulers.DatabaseScheduler --settings=settings --loglevel=INFO
— I get an error like this:
[2012-01-02 19:06:52,009: WARNING/MainProcess] ERROR: Pidfile (celerybeat.pid) a lready exists. Seems we're already running? (PID: 2364) [2012-01-02 19:06:52,012: INFO/MainProcess] process shutting down
and celerybeat never actually starts. So I can’t execute any periodic tasks … Any ideas? I only found one other page where somebody highlighted a similar error, but no solution was offered.
If there’s any further information needed, please let me know. I’m baffled because I can’t find any information on this subject, and I’ve been trying solve this problem all day today … Thank you.
Advertisement
Answer
Search your file system for that pid file and delete it. On unix machines that usually means the program was not shut down correctly. You should check to see if its running in the task manager already, if so kill it, and delete that file
Then try again.
If there is no pid file present, that probably means there’s an issue with the software as it was ported from unix perhaps?