因为Celery 太慢,tasktiger 基于redis
使用很简单:
定义任务
1
2
3
# tasks.py
def my_task():
print 'Hello'
使用 delay 方法
1
2
3
import tasktiger, tasks
tiger = tasktiger.TaskTiger()
tiger.delay(tasks.my_task)
开启进程:
1
2
3
4
5
% tasktiger
{"timestamp": "2015-08-27T21:00:09.135344Z", "queues": null, "pid": 69840, "event": "ready", "level": "info"}
{"task_id": "6fa07a91642363593cddef7a9e0c70ae3480921231710aa7648b467e637baa79", "level": "debug", "timestamp": "2015-08-27T21:03:56.727051Z", "pid": 69840, "queue": "default", "child_pid": 70171, "event": "processing"}
Hello
{"task_id": "6fa07a91642363593cddef7a9e0c70ae3480921231710aa7648b467e637baa79", "level": "debug", "timestamp": "2015-08-27T21:03:56.732457Z", "pid": 69840, "queue": "default", "event": "done"}
项目地址 https://github.com/closeio/tasktiger
本文网址: https://pylist.com/topic/125.html 转摘请注明来源