Python 3的背景处理。
项目描述
dranatiq
适用于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 example
在另一个终端中,开始排队消息
python example.py http://example.com
python example.py https://github.com
python example.py https://news.ycombinator.com
查看用户指南以了解更多信息!
许可
dranatiq遵循LGPL许可。请参阅COPYING和COPYING.LESSER以获取许可详情。
项目详情
下载文件
下载适用于您的平台的文件。如果您不确定选择哪一个,请了解有关安装包的更多信息。
源分布
dramatiq-1.17.0.tar.gz (98.6 kB 查看哈希值)
构建分布
dramatiq-1.17.0-py3-none-any.whl (120.1 kB 查看哈希值)
关闭
dramatiq-1.17.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 7621280160b2f0dcb9cdd20eeee41e009d42bc7cc75a2c4b9b944c641dadd4df |
|
MD5 | 11e7eaeb619e3f0a1b06239bd5e431b6 |
|
BLAKE2b-256 | 37a2e5fd290620f75cea5e84e0199c82cb08334d54b4d102353fb93bb5fab572 |
关闭
dramatiq-1.17.0-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 5c103de1b2f1d3dbca4f80fa7d32312f5253234a14a33277d48b7b2ca9498456 |
|
MD5 | 517b515fe5ed86e9f860bdecf41e7249 |
|
BLAKE2b-256 | d3f58699390dd1ca34039c6eb7d9e3e22c4adb64eb39f437aac900d0b0365f7f |