软件简介

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, 'http://nvie.com')
转载自: https://www.oschina.net/p/python-rq