Quantcast
Channel: CodeSection,代码区,Python开发技术文章_教程 - CodeSec
Viewing all articles
Browse latest Browse all 9596

python 异步任务

$
0
0

月月都有坑,这个月坑最多。吐槽一下,自己最近在利用saltstack 做自动化部署,salt 支持ssh 连接然后执行model 进行初始化,这点很nice, 然后我就啪啪的写代码,用django 调用salt-api,感觉非常赞,easy, 查查发现salt 的ssh 模块有个cmd_async 支持异步调用,结果发现空的,心碎。只能借助于celery 了,自己有啪啪搞定,结果跑的时候调用异步task 的时候报错,

error: daemonic processes are not allowed to have children

又心碎,查了半天,就查了这个

https://github.com/celery/celery/issues/1709

然而。。。。心碎,最后不得不该用django-rq 才解决了问题,折腾了一天,累死了

django-celery/django-rq 的 配置自己就不Up嗦了,比较简单自己参考下面文章

https://github.com/ui/django-rq

http://opslinux.com/2015/09/22/celery定时任务实践/

各种坑


Viewing all articles
Browse latest Browse all 9596

Trending Articles