Lessons about Celery (page 2)
The links, tools and tips our engineers and designers share with each other, one “today I learned” at a time.
- lessons shared
- 28
- people sharing
- 11
- database started in
- 2017








Tech Insights· stackoverflow.com
Easy broker-agnostic way to get number of tasks in a Celery queue:
Shared by
Read on stackoverflow.com- Celery
- Python

docs.celeryproject.org
Debugging code called by celery tasks with rdb #debugging-tasks-remotely-using-pdb
Carlos Coelho

Tech Insights· docs.celeryproject.org
Debugging code called by celery tasks with rdb #debugging-tasks-remotely-using-pdb
Shared by
Read on docs.celeryproject.org- Celery
- Debug

avilpage.com
Auto reload Celery upon changes for development environments
How to automatically reload celery workers in development environment.
Carlos Coelho

Tech Insights· avilpage.com
Auto reload Celery upon changes for development environments
From avilpage.com
How to automatically reload celery workers in development environment.
Shared by
Read on avilpage.com- Celery
- Python

docs.celeryproject.org
Celery has a default configuration that removes every customized logs configuration. So if you change your logs root configur...
Celery has a default configuration that removes every customized logs configuration. So if you change your logs root configuration the changes will only work on the django part. To allow this customization you should do this worker_hijack_root_logger = False: #std:setting-worker_hijack_root_logger
Rebeca Sarai

Tech Insights· docs.celeryproject.org
Celery has a default configuration that removes every customized logs configuration. So if you change your logs root configur...
Celery has a default configuration that removes every customized logs configuration. So if you change your logs root configuration the changes will only work on the django part. To allow this customization you should do this
worker_hijack_root_logger = False: #std:setting-worker_hijack_root_loggerShared by
Read on docs.celeryproject.org- Celery
- Django
- Logging

github.com
heroku's addons for memcached are not explicitly compatible with Celery as result backends, but you can use them with django-celery-results
We created a custom cache for Celery and used [Memcached Cloud]( Our settings for this are looking like: ``` INSTALLED_APPS = [ # ... 'django_celery_results', # ... ] CACHES['celery'] = { 'BACKEND': 'django_bmemcached.memcached.BMemcached', 'LOCATION': MEMCACHED_SERVERS, 'OPTIONS': { 'username': MEMCACHED_USERNAME, 'password': MEMCACHED_PASSWORD, } } CELERY_RESULT_BACKEND = 'django-cache' CELERY_CACHE_BACKEND = 'celery' ``` Obs.: To use Memcached Cloud on Django you have to follow these instructions
Hugo Bessa

Tech Insights· github.com
heroku's addons for memcached are not explicitly compatible with Celery as result backends, but you can use them with django-celery-results
We created a custom cache for Celery and used [Memcached Cloud]( Our settings for this are looking like:
``` INSTALLED_APPS = [ # ... 'django_celery_results', # ... ]
CACHES['celery'] = { 'BACKEND': 'django_bmemcached.memcached.BMemcached', 'LOCATION': MEMCACHED_SERVERS, 'OPTIONS': { 'username': MEMCACHED_USERNAME, 'password': MEMCACHED_PASSWORD, } }
CELERY_RESULT_BACKEND = 'django-cache' CELERY_CACHE_BACKEND = 'celery' ```
Obs.: To use Memcached Cloud on Django you have to follow these instructions
Shared by
Read on github.com- Celery
- Django
- Heroku
- Memcached

docs.celeryproject.org
To list the current Celery tasks names in Redis queue, use:
import json import base64 from redis import StrictRedis redis_client = StrictRedis.from_url(BROKER_URL) default_queue = redis_client.lrange('celery', 0, -1) print({json.loads(base64.b64decode(json.loads(message.decode('utf-8'))['body']).decode('utf-8'))['task'] for message in default_queue}) For reserved and active, use app.control.inspect(): #inspecting-workers
Lais Varejão

Tech Insights· docs.celeryproject.org
To list the current Celery tasks names in Redis queue, use:
import json import base64 from redis import StrictRedis redis_client = StrictRedis.from_url(BROKER_URL) default_queue = redis_client.lrange('celery', 0, -1) print({json.loads(base64.b64decode(json.loads(message.decode('utf-8'))['body']).decode('utf-8'))['task'] for message in default_queue})For reserved and active, useapp.control.inspect(): #inspecting-workersShared by
Read on docs.celeryproject.org- Celery
- Python


Tech Insights· dramatiq.io
Dramatiq: alternative to Celery and RQ:
Shared by
Read on dramatiq.io- Celery
- Python
- Rq
- Tasks

github.com
Celery 4 does NOT send error emails:
After scanning the docs, it doesn't look like Task.send_error_emails (CELERY_SEND_TASK_ERROR_EMAILS) exists anymore. If not, I'd recommend adding it to the removed settings.
Flávio Juvenal

Tech Insights· github.com
Celery 4 does NOT send error emails:
From github.com
After scanning the docs, it doesn't look like Task.send_error_emails (CELERY_SEND_TASK_ERROR_EMAILS) exists anymore. If not, I'd recommend adding it to the removed settings.
Shared by
Read on github.com- Celery
- Link offlineLink offline
Tech Insights· samoylov.eu
Easily configure Celery Flower in production
Shared by
The original link on samoylov.eu is no longer available.
Look for it on the Wayback Machine- Celery
- Flower
- Supervisor

revsys.com
Use priority workers to run celery tasks
Using Celery and Redis for Python asynchronous workers. Part of our 12 Days of Performance Series.
Carlos Coelho

Tech Insights· revsys.com
Use priority workers to run celery tasks
From revsys.com
Using Celery and Redis for Python asynchronous workers. Part of our 12 Days of Performance Series.
Shared by
Read on revsys.com- Celery
- Django
- Python
Today I learned
In Celery configuration use:
app.autodiscover_tasks(lambda: [n.name for n in apps.get_app_configs()]) instead of: app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) autodiscover_tasks() will not understand if you declare in INSTALLED_APPS some app through django AppConfig. (Ex: INSTALLED_APPS += ['users.apps.UsersConfig', ])
Victor Carriço
Tech Insights
In Celery configuration use:
app.autodiscover_tasks(lambda: [n.name for n in apps.get_app_configs()])instead of:
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)autodiscover_tasks()will not understand if you declare inINSTALLED_APPSsome app through djangoAppConfig. (Ex:INSTALLED_APPS += ['users.apps.UsersConfig', ])Shared by
- Celery
- Django
Tech Insights· stackoverflow.com
Retry Celery tasks with exponential backoff:
Shared by
Read on stackoverflow.com- Celery
Tech Insights
If you're using
CELERY_ALWAYS_EAGER = True, probably you'll also wantCELERY_EAGER_PROPAGATES_EXCEPTIONS = Trueto find bugsShared by
- Celery
- Django
Book a call
Found it useful?
Let’s put it to work
Tell us about your product and the problem in front of you. We’ll bring what we’ve learned on real projects.
Tell us about your product, and we’ll bring what we’ve learned.
Still prefer the good old email? Contact us



