ryanhiebert / hirefire

A Python lib to integrate with the HireFire service -- The Heroku Proccess Manager.
https://hirefire.readthedocs.io/
Other
34 stars 21 forks source link

hirefire dosen't scale down #32

Closed t-io closed 7 years ago

t-io commented 7 years ago

Hi, I'm using celery 4 with the latest hirefire. Scaling the worker up works fine but after this the communication with hirefire seems broken. I get the same results with the latest master and release.

KeyError: ('', 'parser')
  File "django/core/handlers/base.py", line 123, in get_response
  File "newrelic/hooks/framework_django.py", line 232, in wrapper
  File "hirefire/contrib/django/middleware.py", line 56, in process_request
  File "hirefire/contrib/django/middleware.py", line 46, in info
  File "hirefire/procs/__init__.py", line 71, in dump_procs
  File "hirefire/procs/celery.py", line 210, in quantity
  File "hirefire/procs/celery.py", line 219, in inspect_count
  File "hirefire/procs/celery.py", line 220, in <genexpr>
  File "hirefire/utils.py", line 116, in __missing__
  File "hirefire/procs/celery.py", line 90, in get_status_task_counts
  File "collections/__init__.py", line 530, in __init__
  File "collections/__init__.py", line 617, in update
  File "hirefire/procs/celery.py", line 73, in get_queue
  File "hirefire/procs/celery.py", line 68, in identify_queue
t-io commented 7 years ago

After setting 'exchange': 'parser', 'routing_key': 'parser' in CELERY_TASK_ROUTES settings and adding my celery app to the proc everything runs fine

ryanhiebert commented 7 years ago

It's very interesting that you seem to have found a workaround for this issue. AFAICT, this is a bug in Celery. celery/celery#3767. The workaround isn't a general solution, but it may work for some people that need to have a workaround, thank you.

Since it's a bug in Celery, it's not something that I can reasonably fix. However, The latest master includes a new feature, called simple_queues, that allows you to tell HireFire that your queue names are the same as the exchange and the routing_key. This handily side-steps the issue for simple cases, but it doesn't fix it.