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. python对象

    一: 基本概念 在pyhton中一切皆对象,就像类unix中的一切皆文件一样,恩,一切.把事物当作对象进行处理, 这样自然就成了面向对象的编程了. 所有的 Python 对像都拥有三个特性:身份,类型 ...

  2. oracle单机改变归档路径

    oracle 归档日志文件路径设置 1.  查看LOG_ARCHIVE_DEST 与 ( LOG_ARCHIVE_DEST_n 或 DB_RECOVERY_FILE_DEST )参数情况注意(  LO ...

  3. Bash之PS1配置

    今天想调整以下PS1的显示,查看了很多文档后有些收获.Bash有可自定义的4类提示: PS1 在每个命令之前显示的主提示符,因此它是每个人都不同的. PS2 当一个命令需要更多的输入(例如,一个多行命 ...

  4. Apache Shiro 简单概念

    Apache Shiro 是ASF旗下的一款开源软件(Shiro发音为"shee-roh",日语"堡垒(Castle)"的意思),提供了一个强大而灵活的安全框架 ...

  5. 解决错误: Failed to load class "org.slf4j.impl.StaticLoggerBinder"

    当报这个错时,就很难看到我们自己输出的日志,系统运行情况后台无法得到输出.解决方案是加入以下依赖: <dependency> <groupId>org.slf4j</gr ...

  6. C#实现对Windows 服务安装

    Windows服务作用:定时用户消息推送,WEB程序实时统计等 Windows服务创建:C#创建服务的方式也有很多种,建议大家在做之前可以先全面了解一下这方面东西再去动手这样便于解决中间遇到一些比较棘 ...

  7. Hibernate5.2关联关系之单向多对一(二)

    Hibernate5.2之单向一对多(二) 一. 简介 在本篇博文中笔者会在上一篇博客的代码基础上进行修改,本篇文章将介绍单向的一对多. 二. hbm文件的方式 Customer.hbm.xml &l ...

  8. 局部变量&&malloc函数&&生命周期的一些见解

    最近在温习指针的部分时发现了一个有趣的问题,先看以下程序: //1.c #include<stdio.h> int* fun() { int t = 567; return &t; ...

  9. 【转】基于第一个PhoneGap(cordova)的应用详解

    PhoneGap是一套能让你使用HTML5轻松调用本地API接口和发布应用到商店的应用开发平台.官方说有低成本,低开发周期,轻量化等优点,这些咱暂时也没法证明,略过不表.但是有一条跨平台,却是很明显的 ...

  10. 学习C++的第三天

    1.sort函数(默认升序排序(从小到大)) 要使用此函数只需用#include <algorithm> sort即可使用,语法描述为:      sort(begin,end),表示一个 ...