2

I want to monitor a queue to be notified when it becomes empty. To do this I need to find out how many messages are in the queue and this task needs to run every interval ex. every 15 seconds.

I am confused reading the docs which say that you shouldn't use celerybeat in a worker for production, so does this mean I need to create a separate python script that utilizes periodic tasks? Not sure how I can implement this.

user299709
  • 4,922
  • 10
  • 56
  • 88

1 Answers1

1

You can retrieve number of messages in a queue using this answer.

For beat, you can always start a new process using

celery beat

If you don't want to use beat at all, you can schedule a cron job which will do that for you.

Community
  • 1
  • 1
Chillar Anand
  • 27,936
  • 9
  • 119
  • 136
  • say im using pyrabbit, how would i tell celery beat to run this every 30 seconds? – user299709 Nov 22 '14 at 07:49
  • run a periodic task http://celery.readthedocs.org/en/latest/userguide/periodic-tasks.html#entries – Chillar Anand Nov 22 '14 at 07:51
  • where do I put CELERYBEAT_SCHEDULE , in the same script as the one my workers are using? wouldn't that create multiple schedules? or does only the worker with `-B` option run that every interval? if a worker doesn't have -B specified, it will ignore it? – user299709 Nov 22 '14 at 07:55
  • this(https://gist.github.com/ChillarAnand/f660e18ca4a4c13a8645) is my periodic tasks and i run worker with `celery beat -A periodic_task` – Chillar Anand Nov 22 '14 at 08:54