python celery + redis
redis
http://debugo.com/python-redis
celery
https://gist.github.com/neara/11214948
https://gist.github.com/amatellanes/a986f6babb9cf8556e36
https://gist.github.com/IrSent/5e4820f6b187d3654967b55e27d5d204
http://funhacks.net/2016/12/13/celery/
https://www.ibm.com/developerworks/cn/opensource/os-cn-celery-web-service/index.html
http://docs.jinkan.org/docs/celery/getting-started/introduction.html
http://liuzxc.github.io/blog/celery/
https://realpython.com/blog/python/flask-by-example-implementing-a-redis-task-queue
http://liuzxc.github.io/blog/celery
http://blog.wifibao.im/index.php/archives/166
http://www.jianshu.com/p/1840035cb510
http://www.jianshu.com/p/9e422d9f1ce2
flask & celery:
https://blog.miguelgrinberg.com/post/using-celery-with-flask
http://liyangliang.me/posts/2015/11/using-celery-with-flask
http://shulhi.com/celery-integration-with-flask
http://aviaryan.in/blog/gsoc/celery-flask-using.html
http://doc.scalingo.com/languages/python/celery/getting-started-with-celery-and-flask
http://www.adikrishnan.in/2016/03/03/using-celery-with-flask/
flask & celery & redis:
http://celeodor.com/flask-flask-socketio-celery-and-redis-background-task-processing
https://moinulhossain.me/remote-celery-worker-for-flask-with-separate-code-base
http://louistiao.me/posts/deploy-flask-with-a-celery-task-queue-and-flower-dashboard-using-kubernetes
http://www.cnblogs.com/ajianbeyourself/p/4471391.html
ansible & celery
http://fengxsong.github.io/2016/05/27/ansible-celery
https://github.com/Erazx/ansible_api
https://github.com/onlytiancai/ansible-celery-flask-demo
https://github.com/yumaojun03/ansible_async_api
https://github.com/fengxsong/django-example
http://www.cnblogs.com/piperck/p/5391128.html
http://www.revsys.com/12days

yum -y install redis
chkconfig redis on && /etc/init.d/redis start
venv
pip install redis -i https://pypi.douban.com/simple
pip install celery -i https://pypi.douban.com/simple
broker(broker.py)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from celery import Celery, platforms
platforms.C_FORCE_ROOT = True
app = Celery(__name__, broker='redis://127.0.0.1:6379/0', backend='redis://127.0.0.1:6379/0', include=['tasks'])
worker(tasks.py)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from broker import app
import time
@app.task
def longtime_add(x, y):
print 'long time task begins'
# sleep 5 seconds
time.sleep(5)
print 'long time task finished'
return x + y
client(run_tasks.py)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from tasks import longtime_add
import time
if __name__ == '__main__':
result = longtime_add.delay(1,2)
# at this time, our task is not finished, so it will return False
print 'Task finished? ', result.ready()
print 'Task result: ', result.result
# sleep 10 seconds to ensure the task has been finished
time.sleep(10)
# now the task should be finished and ready method will return True
print 'Task finished? ', result.ready()
print 'Task result: ', result.result
celery -A broker worker -l info
python run_tasks.py
python celery + redis的更多相关文章
- python之redis和memcache操作
Redis 教程 Redis是一个开源(BSD许可),内存存储的数据结构服务器,可用作数据库,高速缓存和消息队列代理.Redis 是完全开源免费的,遵守BSD协议,是一个高性能的key-value数据 ...
- django+celery+redis环境搭建
初次尝试搭建django+celery+redis环境,记录下来,慢慢学习~ 1.安装apache 下载httpd-2.0.63.tar.gz,解压tar zxvf httpd-2.0.63.tar. ...
- Python Celery队列
Celery队列简介: Celery 是一个 基于python开发的分布式异步消息任务队列,通过它可以轻松的实现任务的异步处理, 如果你的业务场景中需要用到异步任务,就可以考虑使用celery. 使用 ...
- django celery redis 定时任务
0.目的 在开发项目中,经常有一些操作时间比较长(生产环境中超过了nginx的timeout时间),或者是间隔一段时间就要执行的任务. 在这种情况下,使用celery就是一个很好的选择. cele ...
- celery + redis quick start
软件: redis server redis-server.exe 安装redis for python using pip 安装celery (redis) pip install -U &quo ...
- Celery+redis实现异步
目录 Celery+redis实现异步 安装redis 安装celery-with-redis 添加celery相关配置 创建异步运行任务tasks.py 启动 Celery+redis实现异步 安装 ...
- python—Celery异步分布式
python—Celery异步分布式 Celery 是一个python开发的异步分布式任务调度模块,是一个消息传输的中间件,可以理解为一个邮箱,每当应用程序调用celery的异步任务时,会向brok ...
- django+celery+redis实现运行定时任务
0.目的 在开发项目中,经常有一些操作时间比较长(生产环境中超过了nginx的timeout时间),或者是间隔一段时间就要执行的任务. 在这种情况下,使用celery就是一个很好的选择. cele ...
- Python操作Redis(一)
redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).set(集合).zset(sorted set ...
随机推荐
- multithreading - Reader/Writer Locks in C++
You Only Need To Note This: only 1 single thread can acquire an upgrade_lock at one time. others are ...
- [THINKING IN JAVA]初始化和清理
4.5初始化和清理 5.1 构造器初始化 无参:如果一个类没有构造器,那么会有一个默认的无参构造器,并且只能通过无参构造器初始化对象: 带参:传入参数初始化成员变量或者其它初始化操作需要的参数,如果类 ...
- C#导出Excel,并设置简单格式
protected void ExportExcel(DataTable dt) { string fileName = “FileName”; Microsoft.Office.Interop.Ex ...
- C#(转自wiki)
C#是微软推出的一种基于.NET框架的.面向对象的高级编程语言.C#的发音为"C sharp",模仿音乐上的音名"C♯"(C调升),是C语言的升级的意思.其正确 ...
- Web 应用程序中的安全向量 – ASP.NET MVC 4 系列
Web 程序运行在标准的.基于文本的协议(HTTP 和 HTML)之上,所以特别容易受到自动攻击的伤害.本章主要介绍黑客如何滥用应用程序,以及针对这些问题的应对措施. 威胁:跨站脚本 ...
- 数据注解和验证 – ASP.NET MVC 4 系列
不仅在客户端浏览器中需要执行验证逻辑,在服务器端也需要执行.客户端验证能即时给出一个错误反馈(阻止请求发送至服务器),是时下 Web 应用程序所期望的特性.服务器端验证,主要是因为来自网 ...
- EnumRemarkAttribute,获取属性值
首先自定义一个RemarkAttribute [html] view plain copy using System; using System.Collections.Generic; usin ...
- linux yum命令详解-转
yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器.基於RPM包管理,能够从指定的服务器自动下载RP ...
- 实战之中兴ZXHN F460光猫破解超级密码+开启无线路由功能
本文面向小白用户,即使你不懂电脑看完你也会破解光猫,网上有些文章的操作方法是错误的.按照我这篇文章,只要型号对,那么肯定没问题!电信光纤入户,家里用的是电信送的中兴查看 ZXHN F460 中的全部文 ...
- Oracle基本教程
Oracle基本教程 1.Oracle介绍 2.SqlPlus使用 3.用户管理与权限控制 4.数据库备份与还原 5.物理备份--Rman 6.常用查询 7.Oracle用法集锦 8.oracle修改 ...