celery安装测试
来源:互联网 发布:两小无猜 网络剧 编辑:程序博客网 时间:2024/06/11 03:49
参考这篇文章:http://my.oschina.net/u/2306127/blog/417360
由于选择RabbitMQ作为消息中间件,先安装运行RabbitMQ,详见http://blog.csdn.net/mirahs/article/details/48496611
安装celery
pip install celery
编写一个简单的任务,tasks.py
from celery import Celeryapp = Celery('tasks', backend='amqp', broker='amqp://guest@localhost//')app.conf.CELERY_RESULT_BACKEND = 'amqp://'@app.taskdef add(x, y): return x + y
在当前目录运行一个worker,用来执行这个tasks
[root@test celery]# export C_FORCE_ROOT=/root[root@test celery]# celery -A tasks worker --loglevel=info
客户端代码,test_tasks.py
from tasks import add import timeresult = add.delay(4, 4)print 'waiting result...'while not result.ready(): time.sleep(2)print 'Result: ', result.get()
执行测试
[root@test celery]# python test_tasks.py waiting result...Result: 8
0 0
- celery安装测试
- Celery(1):celery简介及安装
- python 安装celery
- Celery的安装和使用
- 安装使用celery异步任务
- celery 监控工具 flower安装
- Windows安装并使用Celery
- Celery
- celery
- celery
- Celery
- Celery、flower和celery-redis 的安装与使用
- celery-redis的安装和使用
- python安装包制作|Django+Celery+Rabbitmq
- Nginx+uwsgi+django+RabbitMQ+celery安装配置
- 01.Celery 简介、安装和HelloWrold
- celery+Rabbit MQ的安装和使用
- [Celery]Celery 最佳实践
- The resource could not be loaded because the App Transport Security policy requires the use of a sec
- mysql修改表、字段、库的字符集
- Android中关于Adapter的使用(下)BaseAdapter
- oracle 11g DataGuard 数据保护模式切换
- 线程和进程的区别
- celery安装测试
- sql中where 1=1 和where 0=1的作用
- myBatis抛出异常Result Maps collection already contains value of xxx
- 构建方法返回String的报错问题
- 变化
- 最大的对称子串
- 从xcode7回到6.4之后的(null): Linker command failed with exit code 1 (use -v to see invocation)问题
- Unity5.2.0无法使用Visual Studio 2013调试问题解决方案
- MQ安装