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

  1. yum -y install redis
  2. chkconfig redis on && /etc/init.d/redis start

venv

  1. pip install redis -i https://pypi.douban.com/simple
  2. pip install celery -i https://pypi.douban.com/simple

broker(broker.py)

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from __future__ import absolute_import
  4. from celery import Celery, platforms
  5. platforms.C_FORCE_ROOT = True
  6. app = Celery(__name__, broker='redis://127.0.0.1:6379/0', backend='redis://127.0.0.1:6379/0', include=['tasks'])

worker(tasks.py)

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from __future__ import absolute_import
  4. from broker import app
  5. import time
  6. @app.task
  7. def longtime_add(x, y):
  8. print 'long time task begins'
  9. # sleep 5 seconds
  10. time.sleep(5)
  11. print 'long time task finished'
  12. return x + y

client(run_tasks.py)

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from tasks import longtime_add
  4. import time
  5. if __name__ == '__main__':
  6. result = longtime_add.delay(1,2)
  7. # at this time, our task is not finished, so it will return False
  8. print 'Task finished? ', result.ready()
  9. print 'Task result: ', result.result
  10. # sleep 10 seconds to ensure the task has been finished
  11. time.sleep(10)
  12. # now the task should be finished and ready method will return True
  13. print 'Task finished? ', result.ready()
  14. print 'Task result: ', result.result
  1. celery -A broker worker -l info
  1. 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. UVA 10815

    题意:输入文本,把不同的单词按照字典序排列. /* tolower 功 能: 把字符转换成小写字母,非字母字符不做出处理 头文件 目前在头文件iostream中也可以使用 isalpha 一种函数:判 ...

  2. ubuntu 安装git服务器

    ubuntu14.04安装git,搭建环境 1.sudo apt-get install git 2.生成key ssh-keygen -t rsa 3.保存其他用户,创建的ssh用户密码 cd .s ...

  3. js中遍历对象的属性和值

    今天想看一下js的数组遍历的内容,搜索到了一个关于对象遍历写好的函数,保留一下.以后好用. function allPrpos ( obj ) {   // 用来保存所有的属性名称和值   var p ...

  4. js 循环切换图片

    function changeLot(){ var minIndex = 1; var maxIndex = 100; var curIndex = 10; var src = $("ul ...

  5. cookie欺骗

    1.什么是cookie欺骗改变cookie的值,发给服务器,就是cookie欺骗.正常情况下,受浏览器的内部cookie机制所限,每个cookie只能被它的原服务器所访问,我们操作不了原服务器. 2. ...

  6. Linux查看redis进程

    命令: ps ef|grep redis 返回上一级cd ..

  7. [转载]Eclipse调试Java的10个技巧

    原文:http://www.oschina.net/question/82993_69439 我也特别喜欢的是Drop to frame. 在看这篇文章前,我推荐你看一下Eclipse 快捷键手册,我 ...

  8. javascript——Array

    # js数组分为属性和方法 ## 属性 1.constructor返回对创建此对象的数组函数的引用. 这个其实在javascript中的对象都有 var a = [] console.log(a.co ...

  9. TFS下的源代码控制

    以下主要描述了: TFS源代码控制系统的基本场景 如何把一个项目添加到源代码管理中 如何与服务器同步 如何做Check-In 如何做分支与合并 什么是上架与下架 我们知道工作项是项目管理的基本元素,但 ...

  10. c#读取INI文件

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.I ...