You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rq/rq/__init__.py

25 lines
801 B
Python

from redis import Redis
from .proxy import conn
from .queue import Queue, FailedQueue
from .worker import Worker
from .job import Job
from .version import VERSION
def use_redis(redis=None):
"""Pushes the given Redis connection (a redis.Redis instance) onto the
connection stack. This is merely a helper function to easily start
using RQ without having to know or understand the RQ connection stack.
When given None as an argument, a (default) Redis connection to
redis://localhost:6379 is set up.
"""
if redis is None:
redis = Redis()
elif not isinstance(redis, Redis):
raise TypeError('Argument redis should be a Redis instance.')
conn.push(redis)
__all__ = ['conn', 'Queue', 'FailedQueue', 'Worker', 'Job', 'use_redis']
__version__ = VERSION