微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Dramatiq Python 分布式任务处理库

程序名称:Dramatiq

授权协议: LGPL-3.0

操作系统: 跨平台

开发语言: Python

Dramatiq 介绍

Dramatiq一个 Python 3 (3.5或更高版本)分布式任务处理库,特点是简单、可靠和高性能

Demo

import dramatiq
import requests

@dramatiq.actor
def count_words(url):
   response = requests.get(url)
   count = len(response.text.split(" "))
   print(f"There are {count} words at {url!r}.")

# Synchronously count the words on example.com in the current process
count_words("http://example.com")

# or send the actor a message so that it may perform the count
# later, in a separate process.
count_words.send("http://example.com")

使用

RabbitMQ 一起使用:

$ pip install -U dramatiq[rabbitmq, watch]

Redis 一起使用:

$ pip install -U dramatiq[redis, watch]

具体使用方法阅读 MotivationUser
Guide

Dramatiq 官网

https://dramatiq.io/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐