R
Railway6mo ago
botdev

Starting multiple celery workers

How can I start multiple celery workers? Here is my procfile: web: celery -A celery_folder.celery_config worker --loglevel=info & python app.py
11 Replies
Percy
Percy6mo ago
Project ID: e1945e5f-b9fa-48e6-94d2-71b38a682cb7
botdev
botdev6mo ago
e1945e5f-b9fa-48e6-94d2-71b38a682cb7
Brody
Brody6mo ago
you would need two railway services, exact duplicates except in each services settings you'd set the applicable start commands, in one service you set the start command to start your app and then in the other service set the start command to start celery
botdev
botdev6mo ago
I have one telegram bot. It in there is celery configuration. Telegram bots cannot have multiple instances. Would this still work?
Brody
Brody6mo ago
I never said to run two bots?
botdev
botdev6mo ago
What I understand is that there will be two services. One for telegram bot the other is for celery. I have two more questions: 1. How my telegram bot call celery task which is running in another service? Should I use API endpoint? 2. Still, what is the procfile would look like to start two celery workers on the service side where my celery is running?
Brody
Brody6mo ago
1. that would be up to your best judgement, you know your app and celery better than me. 2. Procfiles aren't used at all in this methodology, and unless celery itself has a way to run two workers you would need to run another railway service
botdev
botdev6mo ago
Hi, guys. I have a question related to celery. There are a lot of tasks queued on my message broker which is redis. Deployed as a separate service. How can I delete all the queued tasks? Would redeploying be helpfull?
Brody
Brody6mo ago
your app should be clearing tasks after they are completed
botdev
botdev6mo ago
Currently, My users requests too many times. I dont know how much. But my celery is executing them one by one. which is like 5 hours after the task was received. Right know, want to cancel all of the tasks. I dont know how to do it all the tasks include the tasks that has not be picked up by celery worker yet. Is it possible to somehow empty the task queue?
Brody
Brody6mo ago
sorry I have no experience with celery and thats sounding a little more like a celery question than a railway question