SlideShare a Scribd company logo
Kishor Kumar Mahato
Python Lead at Eagle Vision IT
Python User Group Nepal Meetup #7
2nd August 2015
Celery
Asynchronous Task Queues
Asynchronous Task Queues with Celery
 Distributed Asynchronous Task Queue For Python
 It is a task queue which focus on real-time processing
 It also supports task scheduling
• Anything that needs to run asynchronously, eg.
outside of the request-response cycle.
• Background computation of ‘expensive queries’
• Interactions with external API’s (eg. Twitter)
• Periodic tasks (instead of cron & scripts)
• Long-running actions with results displayed via
AJAX.
Potential Uses
Asynchronous Task Queues with Celery
Work Flow
Celery Workers
 Run at least 1 celery worker server ( Redis /
RabbitMQ)
 Can be on different machines
 Celery guarantees that tasks are only executed
once
Task
from celery.task import Task
from celery.registry import tasks
class FetchUserInfoTask(Task):
def run(self, screen_name, **kwargs):
logger = self.get_logger(**kwargs)
try:
user = twitter.users.show(id=screen_name)
logger.debug("Successfully fetched {0}".format(screen_name))
except TwitterError:
logger.error("Unable to fetch {0}: {1}".format( screen_name, TwitterError))
raise
return user
tasks.register(FetchUserInfoTask)
>>> from myapp.tasks import FetchUserInfoTask
>>> result = FetchUserInfoTask.delay(“kishor_14”)
Run It!
Periodic Tasks
from celery.task import PeriodicTask
from celery.registry import tasks
from datetime import timedelta
class FetchMentionsTask(Task):
run_every = timedelta(seconds=60)
def run(self, **kwargs):
logger = self.get_logger(**kwargs)
mentions = twitter.statuses.mentions()
for m in mentions:
ProcessMentionTask.delay(m)
return len(mentions)
tasks.register(FetchMentionsTask)
Periodic Tasks
from datetime import timedelta
from celery.schedules import crontab
CELERYBEAT_SCHEDULE = {
'order-reminder-every-1-hours': {
'task’: 'application.views.cron_job_for_application_processing',
'schedule': crontab(minute=0, hour='*/1')
# 'schedule': timedelta(seconds=30)
},
}
CELERY_TIMEZONE = 'UTC'
Support
 http://groups.google.com/group/celery-users/
 http://celery.readthedocs.org/en/latest/index.html
Asynchronous Task Queues with Celery
Thank You!
Kishor Kumar Mahato
cyberkishor@gmail.com
@kishor_14
fb:kishrorkumar

More Related Content

What's hot (20)

PDF
Celery
Fatih Erikli
 
PDF
Practical Celery
Cameron Maske
 
PDF
Celery with python
Alexandre González Rodríguez
 
PDF
Advanced task management with Celery
Mahendra M
 
PDF
Data processing with celery and rabbit mq
Jeff Peck
 
PDF
Celery: The Distributed Task Queue
Richard Leland
 
PDF
Life in a Queue - Using Message Queue with django
Tareque Hossain
 
PDF
Celery
Òscar Vilaplana
 
PDF
Containers & Dependency in Ember.js
Matthew Beale
 
KEY
PyCon US 2012 - State of WSGI 2
Graham Dumpleton
 
PDF
Rest api with Python
Santosh Ghimire
 
PDF
Hacking ansible
bcoca
 
PDF
AnsibleFest 2014 - Role Tips and Tricks
jimi-c
 
PDF
V2 and beyond
jimi-c
 
PDF
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Masahiro Nagano
 
PPTX
Avoiding callback hell in Node js using promises
Ankit Agarwal
 
PDF
OneRing @ OSCamp 2010
Qiangning Hong
 
KEY
GPerf Using Jesque
ctoestreich
 
PDF
Rails Security
Wen-Tien Chang
 
PDF
Build Web Apps using Node.js
davidchubbs
 
Celery
Fatih Erikli
 
Practical Celery
Cameron Maske
 
Celery with python
Alexandre González Rodríguez
 
Advanced task management with Celery
Mahendra M
 
Data processing with celery and rabbit mq
Jeff Peck
 
Celery: The Distributed Task Queue
Richard Leland
 
Life in a Queue - Using Message Queue with django
Tareque Hossain
 
Containers & Dependency in Ember.js
Matthew Beale
 
PyCon US 2012 - State of WSGI 2
Graham Dumpleton
 
Rest api with Python
Santosh Ghimire
 
Hacking ansible
bcoca
 
AnsibleFest 2014 - Role Tips and Tricks
jimi-c
 
V2 and beyond
jimi-c
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Masahiro Nagano
 
Avoiding callback hell in Node js using promises
Ankit Agarwal
 
OneRing @ OSCamp 2010
Qiangning Hong
 
GPerf Using Jesque
ctoestreich
 
Rails Security
Wen-Tien Chang
 
Build Web Apps using Node.js
davidchubbs
 

Viewers also liked (20)

PPT
Induction 13/14
The City of Liverpool College
 
PDF
Engaging the workforce
Mandeep Singh
 
PDF
CFA Level 1
Adam Vu
 
PPTX
Express Desing
Juanes Alzt
 
PDF
Choose Experiential Tech Wisely (at EventTech 2016)
John C. Buzzell
 
PPTX
Contextos del salón de clases para el crecimiento
Car Gallegos Ortiz
 
PDF
01 dieta dukan fase ataque
Flander Silveira
 
PPTX
Power point project
smithed
 
PPSX
Gastronomy
ebiasmss
 
PPT
presentation to UK Ireland planning research conference 12-14 September
ruralfringe
 
PPTX
Agitation For Increased Bioavailability
polyharrisson
 
PDF
Social media as a tool to improve communication
Maxim Boiko Savenko
 
PPTX
The Technology In Education From Children
Laura Arias Ocampo
 
PDF
Social Media Optimisation
CIM East of England
 
PPT
Una petita dedicatoria per una gran persona
BertaPalaus
 
PDF
Wii目錄(日版)
GameShop
 
PDF
Informe trimestral 2013
Daniel Francisco Doffo
 
PPT
강의자료9
Young Wook Kim
 
PPTX
Els joves power point
pcorominas5
 
Engaging the workforce
Mandeep Singh
 
CFA Level 1
Adam Vu
 
Express Desing
Juanes Alzt
 
Choose Experiential Tech Wisely (at EventTech 2016)
John C. Buzzell
 
Contextos del salón de clases para el crecimiento
Car Gallegos Ortiz
 
01 dieta dukan fase ataque
Flander Silveira
 
Power point project
smithed
 
Gastronomy
ebiasmss
 
presentation to UK Ireland planning research conference 12-14 September
ruralfringe
 
Agitation For Increased Bioavailability
polyharrisson
 
Social media as a tool to improve communication
Maxim Boiko Savenko
 
The Technology In Education From Children
Laura Arias Ocampo
 
Social Media Optimisation
CIM East of England
 
Una petita dedicatoria per una gran persona
BertaPalaus
 
Wii目錄(日版)
GameShop
 
Informe trimestral 2013
Daniel Francisco Doffo
 
강의자료9
Young Wook Kim
 
Els joves power point
pcorominas5
 
Ad

Similar to Asynchronous Task Queues with Celery (20)

PPT
Introduction to Django-Celery and Supervisor
Suresh Kumar
 
PDF
Celery introduction
Ionel Mărieș Cristian
 
PDF
Celery by dummy
Dungjit Shiowattana
 
PDF
Asynchronous job queues with python-rq
Ashish Acharya
 
PDF
PyCon India 2012: Celery Talk
Piyush Kumar
 
PPTX
Celery in the Django
Walter Liu
 
PDF
Tasks: you gotta know how to run them
Filipe Ximenes
 
PDF
7 ways to execute scheduled jobs with python
Hugo Shi
 
PPT
Paralle Programming in Python
Ghazal Tashakor
 
PDF
Why and how Pricing Assistant migrated from Celery to RQ - Paris.py #2
Sylvain Zimmer
 
PPTX
python_development.pptx
LemonReddy1
 
PDF
Queick: A Simple Job Queue System for Python
Ryota Suenaga
 
PDF
Async Web and Python
Jasim Muhammed
 
ODP
Introduction to Python Celery
Mahendra M
 
PDF
Developer-friendly task queues: what we learned building MRQ, Sylvain Zimmer
Pôle Systematic Paris-Region
 
PDF
Developer-friendly taskqueues: What you should ask yourself before choosing one
Sylvain Zimmer
 
KEY
Celery
Yipit
 
PDF
Deixa para depois, Procrastinando com Celery em Python
Adriano Petrich
 
PDF
Asynchronous Python at Kumparan
Bayu Aldi Yansyah
 
PDF
Elegant concurrency
Mosky Liu
 
Introduction to Django-Celery and Supervisor
Suresh Kumar
 
Celery introduction
Ionel Mărieș Cristian
 
Celery by dummy
Dungjit Shiowattana
 
Asynchronous job queues with python-rq
Ashish Acharya
 
PyCon India 2012: Celery Talk
Piyush Kumar
 
Celery in the Django
Walter Liu
 
Tasks: you gotta know how to run them
Filipe Ximenes
 
7 ways to execute scheduled jobs with python
Hugo Shi
 
Paralle Programming in Python
Ghazal Tashakor
 
Why and how Pricing Assistant migrated from Celery to RQ - Paris.py #2
Sylvain Zimmer
 
python_development.pptx
LemonReddy1
 
Queick: A Simple Job Queue System for Python
Ryota Suenaga
 
Async Web and Python
Jasim Muhammed
 
Introduction to Python Celery
Mahendra M
 
Developer-friendly task queues: what we learned building MRQ, Sylvain Zimmer
Pôle Systematic Paris-Region
 
Developer-friendly taskqueues: What you should ask yourself before choosing one
Sylvain Zimmer
 
Celery
Yipit
 
Deixa para depois, Procrastinando com Celery em Python
Adriano Petrich
 
Asynchronous Python at Kumparan
Bayu Aldi Yansyah
 
Elegant concurrency
Mosky Liu
 
Ad

Recently uploaded (20)

PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
July Patch Tuesday
Ivanti
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 

Asynchronous Task Queues with Celery