4

I am working on a project for my university within a team where I was mostly working on the frontend and some basic django models, so I am not so familiar and eloquent with django-celery and I also did not set it up. At first we were using one celery worker, but I had to add one more so I was able to finish a user story.

I am currently running two workers with one in a terminal each like this:

exec celery -A my_proj --concurrency=1 worker
exec celery -A my_proj --concurrency=1 worker -B -Q notification

While i run those two my project works, but I need these to start from one line. So: How do I get those two into one line for a script?

So far I've tried around this:

exec celery multi start celery -A my_proj --concurrency=1 notification -A my_proj --concurrency=1 -B -Q notification

But it stops my project from functioning.

Any help is appreciated, thank you!

Trollgon
  • 45
  • 1
  • 5

2 Answers2

4

Solution

celery multi start 2 -A my_proj -c=1 -B:2 -Q:2 notification

The above tells start 2 workers with the 2nd worker to process the notification queue and embed celery beat to it

Explanation

You can run the following to see the commands resulting from this

celery multi show 2 -A my_proj -c=1 -B:2 -Q:2 notification

Output:

celery worker -A my_proj -c=1
celery worker -A my_proj -c=1 -B -Q notification
Community
  • 1
  • 1
Victor
  • 2,864
  • 1
  • 12
  • 20
0

try

exec celery -A my_proj --concurrency=1 worker && exec celery -A my_proj --concurrency=1 worker -B -Q notification

  • It does not work for me. It seems like it only runs the first part, because when i change the order it runs the other part. – Trollgon Mar 28 '20 at 01:17
  • It doesn't work because when you execute the first part of this, celery runs attached mode so, second part doesn't work. – Onur Taç Sep 28 '22 at 07:35