跳转到主要内容

Python 3的背景处理。

项目描述

dranatiq

Build Status PyPI version Documentation Discuss

适用于Python 3的快速且可靠的分布式任务处理库。


变更日志: https://dramatiq.io/changelog.html
社区: https://groups.io/g/dramatiq-users
文档: https://dramatiq.io


赞助商


Franz:Apache Kafka的桌面客户端

安装

如果您想使用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许可。请参阅COPYINGCOPYING.LESSER以获取许可详情。

项目详情


版本历史 发布通知 | RSS源

下载文件

下载适用于您的平台的文件。如果您不确定选择哪一个,请了解有关安装包的更多信息。

源分布

dramatiq-1.17.0.tar.gz (98.6 kB 查看哈希值)

上传时间:

构建分布

dramatiq-1.17.0-py3-none-any.whl (120.1 kB 查看哈希值)

上传时间: Python 3

支持者: