注册

Python队列服务 Python RQ

RQ (Redis Queue) 是一个简单的 Python 库用于将作业放到队列中并在后台统一执行,使用 Redis 做后端,可方便的跟 Web 前端集成。

示例代码:
import requests

def count_words_at_url(url):
resp = requests.get(url)
return len(resp.text.split())Then, create a RQ queue:

from rq import Queue, use_connection
use_connection()
q = Queue()And enqueue the function call:
from my_module import count_words_at_url
result = q.enqueue(
count_words_at_url, '**://nvie.com')


已邀请:

要回复问题请先登录注册