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 ...
随机推荐
- 另类分析SIGSEGV信号
关于SIGSEGV信号的含义就不解释了.网络上有很多解释. 今天记录一下,自己遇到的一个问题,想了好几天都没想出来的.今天终于想到原因了. 过程描述: 有个类 CBase,里面放了一个成员变量 DAT ...
- tcpdf最新版 6.2版
tcpdf6.2版,地址记 录 http://download.csdn.net/detail/hayywcy/9547873
- PHP常用的文件操作函数集锦
以下是个人总结的PHP文件操作函数.当然,这只是部分,还有很多,我没有列出来. 一 .解析路径: 1 获得文件名:basename();给出一个包含有指向一个文件的全路径的字符串,本函数返回基本的文件 ...
- 用程序获取 Internet 时间 无通用性程序后的暂用办法
并不是完全失败,但没找到一个通用的办法,这个通用指的不能通用所有的时间服务器,而不是说操作系统. 网上的方案很多,有用Socket类.或TcpClient类(C#).或UdpClient类,端口有使用 ...
- C# 创建开机启动核心代码
#region 访问 AppSettings private void SaveAppSetting(string key, string value) { var config = Configur ...
- Ubuntu14.04+Beanstalkd1.9最佳实践
目录 [TOC] 1.基本概念 1.1.什么是Beanstalkd? Beanstalkd 是一个轻量级消息中间件,它最大特点是将自己定位为基于管道 (tube) 和任务 (job) 的工作队列. ...
- Beta版本冲刺——day7
No Bug 031402401鲍亮 031402402曹鑫杰 031402403常松 031402412林淋 031402418汪培侨 031402426许秋鑫 站立式会议 今日计划表 人员 工作 ...
- IE9 使用document.getElementsByName("abc") 不能获取到名称相同SPAN元素
<div name="abc"></div> <input name="abc" type="text" /& ...
- GraphicsMagick+Im4Java在windows和linux下的配置
GraphicsMagick介绍及安装 Im4Java包为: im4java-1.2.0.jar 直接在lib下引用即可 GraphicsMagick的安装如下: windows下: 安装:Graph ...
- B2B商城网站前端开发
最近在时间很忙,在弄一个B2B商城,运用到的easyUI+javaWEB(maven)+JQuery+Scss+JavaScript+其他框架(sea.js模块化等),我负责前端这块:后期的重要的前端 ...