一个为 Python 3 打造的快速、可靠的后台任务处理库。
一个面向 Python 3 的快速且可靠的分布式任务处理库。
更新日志:https://dramatiq.io/changelog.html
社区:https://groups.io/g/dramatiq-users
文档:https://dramatiq.io
如果你想将它与 RabbitMQ 一起使用
pip install 'dramatiq[rabbitmq, watch]'或者如果你想将它与 Redis 一起使用
pip install 'dramatiq[Redis, watch]'确保 RabbitMQ 正在运行,然后创建一个名为
example.py 的新文件:
import dramatiq
import requests
import sys
@dramatiq.actor
def count_words(url):
response = requests.get(url)
count = len(response.text.split(" "))
print(f"There are {count} words at {url!r}.")
if __name__ == "__main__":
count_words.send(sys.argv[1])在一个终端中,运行你的 worker:
dramatiq 示例
在另一个终端中,开始将消息加入队列:
Python example.py http://example.com
Python example.py https://github.com
Python example.py https://news.ycombinator.com查看[用户指南]以了解更多信息!
dramatiq 基于 LGPL 许可证授权。请参阅 COPYING 和 COPYING.LESSER 了解许可详情。
暂无开放 Issues,或尚未同步最近议题。