0

For my heroku app, the memory keeps growing, and I think it is because the number of messages sent per unit time is more than number of messages processed by the worker. How can I keep a monitor on the number of unprocessed message at any given point of time

dowjones123
  • 3,695
  • 5
  • 40
  • 83

2 Answers2

2
from celery.task.control import inspect

From this SO

If you need logging facilities, check out flower

Community
  • 1
  • 1
  • Thanks, what I want is the number of messages and not the number of tasks (which inspect would give). There could be one single shared_task or PeriodicTask, but different parts of the app could call the same MySharedTask.delay() multiple times in different messages (all referring the same MySharedTask) ; or the same PeriodicTask could be fired every 1 second by the Celery Beat. I want to find out if more messages are being generated per unit time than being processed – dowjones123 Nov 10 '14 at 11:00
0

maybe you need this:

@celery.task(rate_limit='500/m')
def my_task():
    url = "http://www.google.com"
    r = requests.get(url)

rate_limit='500/m' can limit your tasks to operate 500 times in one minute.

no13bus
  • 347
  • 1
  • 4
  • 15