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. C#导出Excel,并设置简单格式

    protected void ExportExcel(DataTable dt) { string fileName = “FileName”; Microsoft.Office.Interop.Ex ...

  2. 子句jion

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

  3. 如何导出和导入mysql数据(数据迁移)

    . 导出数据库数据 mysqldump -uroot -p dp_db > dumpout.sql 其中 root是账户名 dp_db是需要导出的数据库名称 dumpout.sql存储导出的数据 ...

  4. css 多个不定数量提交按钮居中显示,纯css解决

    前几天在公司修改一个css 多个按钮居中问题,其实这样的问题很多前端程序员都遇到过,举个例子吧: 在一行中有三个按钮或是两个按钮...个数不定,然后间距固定:然后就有很多人把所有按钮放到一个div中, ...

  5. phpmyadmin修改root密码

    很多人利用phpmyadmin或者命令行来修改了mysql的root密码,重启 后发现mysql登录错误,这是为什么呢?修改mysql的root的密码要在mysql软件中mysql数据库里修改root ...

  6. 如何在 Delphi 中静态链接 SQLite

    搞了我几个小时,终于成功在 Delphi 中静态链接了 SQLite (v3.5.4),下一步就是研究加密了,呵呵中间其实遇到很多问题,今天累了,就不说了,改天补上 下载测试工程 下面说说方法 1.当 ...

  7. MyBatis入门学习教程-实现关联表查询

    一.一对一关联 1.1.提出需求 根据班级id查询班级信息(带老师的信息) 1.2.创建表和数据 创建一张教师表和班级表,这里我们假设一个老师只负责教一个班,那么老师和班级之间的关系就是一种一对一的关 ...

  8. JSON转Dictionary

    方法很简单,留作以后使用. System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Scrip ...

  9. [经验交流] Kubernetes Nginx Ingress 安装与使用

    Ingress 介绍 Kubernetes 上部署的微服务运行在它的私有网络中, 通过Pod实例的hostPort或Service实例的NodePort可以暴露到主机端口上,便于用户访问.但这样的方法 ...

  10. Windows Server 2012 克隆修改SID

    更改SID后蓝屏\黑屏: 环境:Windows Server 2012 R2 目的:克隆出来的系统的SID都是一样,所以想修改各个系统的SID号 现象:克隆出来的系统的SID都是一样,所以想修改各个系 ...