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的更多相关文章

  1. python之redis和memcache操作

    Redis 教程 Redis是一个开源(BSD许可),内存存储的数据结构服务器,可用作数据库,高速缓存和消息队列代理.Redis 是完全开源免费的,遵守BSD协议,是一个高性能的key-value数据 ...

  2. django+celery+redis环境搭建

    初次尝试搭建django+celery+redis环境,记录下来,慢慢学习~ 1.安装apache 下载httpd-2.0.63.tar.gz,解压tar zxvf httpd-2.0.63.tar. ...

  3. Python Celery队列

    Celery队列简介: Celery 是一个 基于python开发的分布式异步消息任务队列,通过它可以轻松的实现任务的异步处理, 如果你的业务场景中需要用到异步任务,就可以考虑使用celery. 使用 ...

  4. django celery redis 定时任务

    0.目的 在开发项目中,经常有一些操作时间比较长(生产环境中超过了nginx的timeout时间),或者是间隔一段时间就要执行的任务. 在这种情况下,使用celery就是一个很好的选择.   cele ...

  5. celery + redis quick start

    软件: redis server redis-server.exe 安装redis for python using pip 安装celery (redis)  pip install -U &quo ...

  6. Celery+redis实现异步

    目录 Celery+redis实现异步 安装redis 安装celery-with-redis 添加celery相关配置 创建异步运行任务tasks.py 启动 Celery+redis实现异步 安装 ...

  7. python—Celery异步分布式

    python—Celery异步分布式 Celery  是一个python开发的异步分布式任务调度模块,是一个消息传输的中间件,可以理解为一个邮箱,每当应用程序调用celery的异步任务时,会向brok ...

  8. django+celery+redis实现运行定时任务

    0.目的 在开发项目中,经常有一些操作时间比较长(生产环境中超过了nginx的timeout时间),或者是间隔一段时间就要执行的任务. 在这种情况下,使用celery就是一个很好的选择.   cele ...

  9. Python操作Redis(一)

    redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).set(集合).zset(sorted set ...

随机推荐

  1. 集群 & 负载均衡

    集群(Cluster) 指一组计算机系统构成一个松耦合的多处理器系统,它们之间通过网络实现进程间的通信,实现分布式计算.在客户端看来就像是只有一个服务器.集群可以利用多个计算机进行并行计算从而获得很高 ...

  2. 0x00linux32位汇编初入--前期准备

    0x00汇编初入--前期准备 一.汇编工具 在linux平台下常用的编译器为as,连接器为ld,使用的文本编辑器为vim,汇编语法为att 以下是一些工具: addr2line 把地址转换为文件名和行 ...

  3. 编写一个Singleton程序(单例)

    public class Test { private static Test test = new Test(); private Test(){}//构造方法私有化 private static ...

  4. myeclipse激活时cracker2015.jar打不开

    myeclipse激活时cracker2015.jar打不开 可能是jdk版本的问题 这是我用的myeclipse版本 myeclipse-2016-ci-7-offline-installer-wi ...

  5. [linux]解决vsftpd 读取目录列表失败的问题

    使用第三方FTP软件filezilla进行登陆,出现如下错误:状态:    正在连接 192.168.1.6:21...状态:    连接建立,等待欢迎消息...响应:    220 (vsFTPd ...

  6. zabbix3.0安装之图形界面显示异常【server】

    前面记录过Zabbix3.0的安装过程,遇到一些坑,当时就在博文最后提到过,显示界面只有文字没有样式的问题.今天就解决这个小问题. 首先, 我们的安装是基于nginx作为web服务器的,不是传统的用A ...

  7. AES加密算法C++实现

    我从网上下载了一套AES加密算法的C++实现,代码如下: (1)aes.h #ifndef SRC_UTILS_AES_H #define SRC_UTILS_AES_H class AES { pu ...

  8. MS-MPI 的使用

    MPI在windows上的扯淡 MPI的实现一般使用MPICH与OpenMPI,这两个库在12年的版本就已经停止了对windows的更新,不支持MPI的新特性(也不知道有没有bug方面的问题),配置的 ...

  9. 将 Shiro 作为应用的权限基础

    Shiro 是 Java 世界中新近出现的权限框架,较之 JAAS 和 Spring Security,Shiro 在保持强大功能的同时,还在简单性和灵活性方面拥有巨大优势.本文介绍了 Shiro 的 ...

  10. ie浏览器,背景色兼容解决方法

    rgba的含义,r代表red,g代表green,b代表blue,a代表透明度.红绿蓝是三原色,所有颜色都可以由这三种颜色拼合而成.比如 rgba(0,0,0,.5)就是透明度为0.5的黑色.现代浏览器 ...