[英]celery- modify task scheduler time
I have a period task which schedule is got from database 我有一个定期任务,该时间表是从数据库中获取的
Because we want the value can be changed by user 因为我们希望该值可以由用户更改
app.conf.CELERYBEAT_SCHEDULE = {
'do_something': {
'task': 'celery_task.tasks.do_something',
'schedule': timedelta(seconds=get_setting()),
'options': { 'queue': 'do_something',
'expires':get_setting()}
},
When I execute celery beat -A project --loglevel=INFO
当我执行
celery beat -A project --loglevel=INFO
it run the task by every timedelta(seconds=get_setting()
它每隔
timedelta(seconds=get_setting()
运行一次任务
But when I change the time in database 但是当我更改数据库中的时间时
The task still use old schedule time 该任务仍使用旧的计划时间
How can I let it use new schedule time???? 如何让它使用新的时间表时间????
Could it possible without restart celery beat?? 不重新启动芹菜拍子就可以吗?
Celery offers the option to build a custom scheduler. Celery提供了构建自定义计划程序的选项。 You can read about it here .
你可以在这里阅读。 Also, you can see examples in this SE question and this github repository.
另外,您可以在此 SE问题和此 github存储库中查看示例。
Shortly, you need to implement a new scheduler that syncs entries from a DB. 不久,您需要实现一个新的调度程序,该调度程序将同步数据库中的条目。 Good luck!
祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.