Dramatiq 是一个Pytho3(3.5或更高版本)分布式任务处理库,特点是简单、可靠和高性能。
Demo
import dramatiqimport requests@dramatiq.actordef cout_words(url): respose = requests.get(url) cout = le(respose.text.split(" ")) prit(f"There are {cout} words at {url!r}.")# Sychroously cout the words o example.com i the curret processcout_words("https://example.com")# or sed the actor a message so that it may perform the cout# later, i a separate process.cout_words.sed("https://example.com")使用
与 RabbitMQ 一起使用:
$ pip istall -U dramatiq[rabbitmq, watch]与 Redis 一起使用:
$ pip istall -U dramatiq[redis, watch]具体使用方法阅读 Motivatio 或 UserGuide。
评论