如何从redis中将rq中的作业排入队列

时间:2014-06-09 07:07:07

标签: python redis scheduled-tasks

我必须从mysql执行时获取函数和时间然后将这个东西保存到redis.Now来自redis我必须在规定的时间执行函数。我想使用rq作为调度程序但是我无法找到我应该将导入的数据保存到redis中的模型。 我是python和redis的新手

1 个答案:

答案 0 :(得分:1)

如果安装redis,有一个文件(对我来说是〜/ lib / python2.7 / site-packages / rq / queue.py,后者又调用job.py)清楚地说明了enqueue和enqueue_call函数:

def enqueue_call(self, func, args=None, kwargs=None,
                 timeout=None, result_ttl=None, description=None,
                 depends_on=None):
    """Creates a job to represent the delayed function call and enqueues it.

    It is much like `.enqueue()`, except that it takes the function's args
    and kwargs as explicit arguments.  Any kwargs passed to this function
    contain options for RQ itself.
    etc...."""

def enqueue(self, f, *args, **kwargs):
    """Creates a job to represent the delayed function call and enqueues it.

    Expects the function to call, along with the arguments and keyword
    arguments.
    etc...."""