Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Tarefas assíncronas com django e celery
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Allisson Azevedo
June 11, 2013
Programming
1
24k
Tarefas assíncronas com django e celery
Slides da palestra no mutirão python:
https://plus.google.com/events/c4a18aljra59dqf56t1lac89o4k
Allisson Azevedo
June 11, 2013
Tweet
Share
More Decks by Allisson Azevedo
See All by Allisson Azevedo
Programação Assíncrona com Asyncio
allisson
0
120
Crawleando sites com NodeJS
allisson
0
180
Introdução a linguagem Go
allisson
0
320
Docker + Django
allisson
5
670
Construindo um micro framework web em Python
allisson
0
240
Consumindo API's OAuth{1,2} com Python
allisson
1
200
Deploy completo de uma aplicação Django
allisson
6
520
Desenvolvimento Web com Django
allisson
0
150
Otimizando sites com o nosql redis
allisson
4
180
Other Decks in Programming
See All in Programming
AI時代の認知負荷との向き合い方
optfit
0
180
日本だけで解禁されているアプリ起動の方法
ryunakayama
0
360
Claude Codeセッション現状確認 2026福岡 / fukuoka-aicoding-00-beacon
monochromegane
3
220
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
160
浮動小数の比較について
kishikawakatsumi
0
340
CSC307 Lecture 08
javiergs
PRO
0
690
Head of Engineeringが現場で回した生産性向上施策 2025→2026
gessy0129
PRO
0
190
2026年は Rust 置き換えが流行る! / 20260220-niigata-5min-tech
girigiribauer
0
200
2025年の活動の振り返り
hideg
0
110
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
5
890
今、アーキテクトとして 品質保証にどう関わるか
nealle
0
180
nilとは何か 〜interfaceの構造とnil!=nilから理解する〜 / Understanding nil in Go Interface Representation and Why nil != nil
kuro_kurorrr
2
1k
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
174
15k
Designing Powerful Visuals for Engaging Learning
tmiket
0
250
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
170
GraphQLの誤解/rethinking-graphql
sonatard
74
11k
A better future with KSS
kneath
240
18k
Done Done
chrislema
186
16k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
110
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
78
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.7k
Context Engineering - Making Every Token Count
addyosmani
9
680
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
190
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
830
Transcript
TAREFAS ASSÍNCRONAS COM DJANGO E CELERY Allisson Azevedo Monday, June
10, 13
ALLISSON AZEVEDO Graduado em Licenciatura em Computação Desenvolvedor Web http://speakerdeck.com/allisson
http://slideshare.net/allisson http://github.com/allisson http://youtube.com/user/allissonazevedo Monday, June 10, 13
Monday, June 10, 13
Monday, June 10, 13
PORQUE EU PRECISO DE UM TASK/JOB QUEUE? Necessidade de processar
uma tarefa fora do ciclo de requisição e reposta Processamento de vídeo/imagens Envio de e-mails Geração de relatórios complexos Comunicação com API’s externas (twitter, facebook) Monday, June 10, 13
PORQUE EU PRECISO DE UM TASK/JOB QUEUE? Agendar tarefas (substituir
o cron) Trabalhar com indexação de um search engine Monday, June 10, 13
COMO FUNCIONA? Client Quem gera a tarefa Message Broker Gerencia
a fila de tarefas Worker Recebe as tarefas do Broker e executa as mesmas Monday, June 10, 13
COMO FUNCIONA? Result Store Onde são guardados os resultados das
tarefas Monday, June 10, 13
CELERY “Distributed Task Queue” Escrito em python Integração com os
principais frameworks python (django, pyramid, flask, web2py, tornado) Broker Backends (rabbitmq, redis, sqlalchemy, django, mongodb) Result Store Backends (Redis, memcached, MongoDB) Monday, June 10, 13
QUAL BROKER USAR? RabbitMQ (http://stackoverflow.com/a/9176046) Redis Não use o broker
como result store Monday, June 10, 13
INTEGRANDO COM O DJANGO pip install django-celery Adicione o djcelery
no INSTALLED_APPS Adicione as linhas no settings.py import djcelery djcelery.setup_loader() Monday, June 10, 13
INTEGRANDO COM O DJANGO Selecione o broker BROKER_URL = 'redis://localhost:6379/0'
#Redis Inicie o worker python manage.py celery worker --loglevel=info Monday, June 10, 13
INTEGRANDO COM O DJANGO Em seus projetos, crie um arquivo
chamado tasks.py Monday, June 10, 13
INTEGRANDO COM O DJANGO from celery import task @task() def
add(x, y): return x + y Monday, June 10, 13
INTEGRANDO COM O DJANGO Rode a task Monday, June 10,
13
INTEGRANDO COM O DJANGO >>> from celerytest.tasks import add >>>
add.delay(2, 2) >>> add.apply_async((2, 2)) Monday, June 10, 13
MÃO NA MASSA! https://github.com/allisson/django-social-monitor- example Monday, June 10, 13
Monday, June 10, 13
OBRIGADO! Monday, June 10, 13