I’m trying to create a Windows Service to launch Celery. I have come across an article that does it using Task Scheduler. However it seems to launch numerous celery instances and keeps eating up memory till the machine dies. Is there any way to launch it as a Windows service?
Share
I got the answer from another website. Celeryd (daemon service for Celery) runs as a paster application, searching for ‘Paster Windows Service’ lead me here. It describes how to run a Pylons application as a Windows Service. Being new to paster framework and hosting python web services, it didn’t cross my mind to check it at first. But that solution works for Celery with a slight change here and there in the script.
I’ve modified the script to make it easier for modifying Celery settings. The essential changes are:
INI file settings (celeryd.ini):
Python script to create Windows Service (CeleryService.py):
To install the service run
python CeleryService.py installand thenpython CeleryService.py startto start the service. NOTE: These commands should be run in command-line with administrator rights.If the service needs to be removed, run
python CeleryService.py remove.I was trying to host Celery as part of enhancing my RhodeCode installation. This solution seems to work. Hope this will help someone.