Queue Everything & Delight Everyone.
What Is Task Queue?
How Task Queue Works?
Why Task Queues?
Task Queue Implementation.
Taks Queue is a mechanism to distribute work across machines/threads.
Producer: Code to place tasks in broker.
Broker: Holds tasks & delivers to workers.
Consumer: Take tasks from broker & execute them.
Install Celery.
Install a broker.
Create tasks & start processing.
# task.py from celery import Celery app = Celery('tasks', backend='amqp', broker='amqp://guest@localhost//') @app.task() def add(x, y): return x + y
# add tasks into queue result = add.delay(3, 4)
# check result result.ready() # result.status result.get()
celery worker --help # all options celery worker -A task -l info -n foo_worker
celery inspect active celery inspect active_queues
Flower: Real-time monitor & web admin for Celery.