RQ Scheduler RQ 作业调度开源项目

我要开发同款
匿名用户2015年02月15日
113阅读

技术信息

开源地址
https://github.com/ui/rq-scheduler
授权协议
MIT

作品详情

RQScheduler是一个小型的Pytho包,用来给RQ添加作业调度功能。

安装:

pip istall rq-scheduler

示例代码:

from redis import Redisfrom rq_scheduler import Schedulerfrom datetime import datetimescheduler = Scheduler(coectio=Redis()) # Get a scheduler for the "default" queue# Puts a job ito the scheduler. The API is similar to RQ except that it# takes a datetime object as first argumet. So for example to schedule a# job to ru o Ja 1st 2020 we do:scheduler.equeue_at(datetime(2020, 1, 1), fuc)# Here's aother example schedulig a job to ru at a specific date ad time (i UTC),# complete with args ad kwargs.scheduler.equeue_at(datetime(2020, 1, 1, 3, 4), fuc, foo, bar=baz)

第二种方法:

from datetime import timedelta# Schedule a job to ru 10 miutes, 1 hour ad 1 day laterscheduler.equeue_i(timedelta(miutes=10), cout_retweets, tweet_id)scheduler.equeue_i(timedelta(hours=1), cout_retweets, tweet_id)scheduler.equeue_i(timedelta(days=1), cout_retweets, tweet_id)

功能介绍

RQ Scheduler 是一个小型的 Python 包,用来给 RQ 添加作业调度功能。 安装:
pip install rq-scheduler 示例代码:
from redis i...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论