Skip to content

Instantly share code, notes, and snippets.

Last active Apr 25, 2018
What would you like to do?
The absolute minimal celerybeat setup
Following is the absolute minimal celerybeat setup. I will use redis as the broker.
Install and run redis
on Ubuntu
sudo apt-get install redis-server
on CentOS
sudo yum install redis
Install celery and redis-py (preferably in a virtual environment)
pip install celery redis
[Note: I tried this on 3.0.23 (Chiastic Slide). You can check version with celery --version]
Have the and files in a directory and run
celery worker -B --loglevel=info
Since I print the values in the tasks, you should see 30 (14+16) every 30 seconds and 60 (3*20) every minute.
If something is wrong, try running with --loglevel=debug and see whether there's something helpful.
from celery.schedules import crontab
from datetime import timedelta
BROKER_URL = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
CELERY_IMPORTS = ('tasks',)
'every-30-secs': {
'task': 'tasks.add',
'schedule': timedelta(seconds=30),
'args': (14, 16),
'every-minute': {
'task': 'tasks.mul',
'schedule': crontab(minute='*/1'),
'args': (3, 20),
from celery import Celery
celery = Celery('tasks',
def add(x, y):
print x + y
return x + y
def mul(x, y):
print x * y
return x * y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment