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 โปรดดูการคัดลอกและการคัดลอก LESSER สำหรับรายละเอียดใบอนุญาต