dramatiq
v1.17.1
一个快速可靠的 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 ])
在一个终端中,运行您的工作人员:
dramatiq example
在另一个中,开始将消息排队:
python example.py http://example.com
python example.py https://github.com
python example.py https://news.ycombinator.com
查看用户指南以了解更多信息!
Dramatiq 根据 LGPL 获得许可。请参阅 COPYING 和 COPYING.LESSER 了解许可详细信息。