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 ...
随机推荐
- COCOS2D-X中UI动画导致闪退与UI动画浅析
前两天和同事一起查一个游戏的闪退问题,log日志显示最后挂在CCNode* ActionNode::getActionNode()函数中的首行CCNode* cNode = dynamic_cast& ...
- first
不知道学啥,怎么办,写博客.找不到工作,怎么办,写博客.好吧,第一天博客完成.-渣渣米
- NTP时间同步服务器设置
一.Window Server设置 [服务器端设置]1) 修改注册表以下键值:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\ ...
- MSXML使用教程
在DOM接口规范中,有四个基本的接口:Document,Node,NodeList以及NamedNodeMap.在这四个基本接口中,Document接口是对文档进行操作的入口,它是从Node接口继承过 ...
- linux下查看系统信息
lspci: 这个工具用来查看所有连接到pci总线上的所有设备信息. 如果有些系统没有lspci,安装后即可使用,有些老死的版本中需要root权限才可使用. 一些用法: lspci 列出所有 ...
- 如何导出和导入mysql数据(数据迁移)
. 导出数据库数据 mysqldump -uroot -p dp_db > dumpout.sql 其中 root是账户名 dp_db是需要导出的数据库名称 dumpout.sql存储导出的数据 ...
- 基于Verilog HDL整数乘法器设计与仿真验证
基于Verilog HDL整数乘法器设计与仿真验证 1.预备知识 整数分为短整数,中整数,长整数,本文只涉及到短整数.短整数:占用一个字节空间,8位,其中最高位为符号位(最高位为1表示为负数,最高位为 ...
- jquery 通知页面变化
var PageTitleNotification = { Vars: { OriginalTitle: document.title, Interval: null, IsNotificationE ...
- LeetCode "468. Validate IP Address"
it is all about corner-cases... class Solution(object): def validIP4(self, IP): def validNum4(s): tr ...
- C# 随机红包算法
static void Main(string[] args) { ; ; double minAmount = 0.01; Random r = new Random(); ; i < num ...