芹菜比cron有什么优势? [英] What are the advantages of celerybeat over cron?

查看:137
本文介绍了芹菜比cron有什么优势?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到很多人喜欢用Cron工作来做周期性的工作。我看到celerybeat的文档,我可以看到有关如何使用它的信息,但不是为什么(或什么时候)我应该更喜欢cronjobs。

I see many people preferring celerybeat over cron jobs for periodic tasks. I see the documentation for celerybeat and I can see information on how to use it, but not why (or when) I should prefer it over cronjobs.

http://docs.celeryproject.org/en/latest/userguide/periodic-tasks .html#介绍

推荐答案

我已经使用了两个,并得出结论, cron。

I have used both and have come to the conclusion that beat is better at control than cron.

您可以将其连接起来,以便您的控制是通过django管理而不是插入并更改crontab。另外,使用节拍时也有一个隐含的可移植性 - 这意味着您可以通过配置而不是登录将其从机器移动到机器。

You can wire it up so that your control is via django admin instead of sshing in and changing the crontab. Also, there is an implicit portability when using beat - meaning you can move it from machine to machine by way of configuration instead of a login.

当然,有缺点而且它们很少。我们曾经使用pid文件来控制一个工作的单例方面,但是现在我们使用一个通用的数据库信号量表(其他人使用了内存缓存,但是我不太满意)。

Of course, there are disadvantages as well but they are few. We used to use pid files to control the singleton aspect of a job but now we use a generic database semaphore table (other people have used memcache, but I just don't feel comfortable with that).

这篇关于芹菜比cron有什么优势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆