Detect whether Celery is Available/Running

Here’s the code I’ve been using. celery.task.control.Inspect.stats() returns a dict containing lots of details about the currently available workers, None if there are no workers running, or raises an IOError if it can’t connect to the message broker. I’m using RabbitMQ – it’s possible that other messaging systems might behave slightly differently. This worked in … Read more

Django Celery Logging Best Practice

When your logger initialized in the beginning of “another module” it links to another logger. Which handle your messages. It can be root logger, or usually I see in Django projects – logger with name ”. Best way here, is overriding your logging config: LOGGING = { ‘version’: 1, ‘disable_existing_loggers’: True, ‘formatters’: { ‘simple’: { … Read more

How to run a celery worker with Django app scalable by AWS Elastic Beanstalk?

This is how I set up celery with django on elastic beanstalk with scalability working fine. Please keep in mind that ‘leader_only’ option for container_commands works only on environment rebuild or deployment of the App. If service works long enough, leader node may be removed by Elastic Beanstalk. To deal with that, you may have … Read more