I am working on a django project where I am using celery. I have three two big modules in the project named app1 and app2. I have created two celery apps for that which are running on two separate machines. In the app1 and app2 there are different tasks which i want to run difference machines and it is working fine. But my problem is that i have some periodic_tasks. I have defined a queue named periodic_tasks
for them. I want to run these periodic tasks on a separate third machine. Or on the third machine I want to run only the periodic tasks, and these periodic tasks shouldn't executed from the other two machines. Is it possible using celery.
Asked
Active
Viewed 333 times
-1

rajpreet singh
- 41
- 5
-
If you have managed to configure celery so that app1 tasks are always run on a different machine than app2 tasks, why can't you do the same with your periodic tasks? There shouldn't be any difference. – Antonis Christofides Oct 17 '16 at 11:10
-
periodic tasks are not in a different app, if those are related to app1 then those are in app1 or so on. – rajpreet singh Oct 18 '16 at 07:12
1 Answers
0
On your third machine, make sure to start up celery with the -Q
or --queues
option with periodic_tasks
. On app1 and app2, start up celery without the periodic_tasks
queue. You can read more about queue handling here: http://docs.celeryproject.org/en/latest/reference/celery.bin.worker.html#cmdoption-celery-worker-Q

2ps
- 15,099
- 2
- 27
- 47
-
Yes, I am trying this using `celery -A proj -Q periodic_tasks` , but when i see `celery inspect registered` it show me list of all the tasks from the complete projects. – rajpreet singh Oct 18 '16 at 07:11
-
Well, yeah, because all workers share a common broker, even if they don’t process all the tasks. – 2ps Oct 18 '16 at 19:17