安排常规事件:Cron / Cron替代品(包括Celery) [英] Scheduling a regular event: Cron/Cron alternatives (including Celery)

查看:135
本文介绍了安排常规事件:Cron / Cron替代品(包括Celery)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我感兴趣的是定期运行一些特定的动作。很明显,这是 cron 的任务,对吧?

Something I've had interest in is regularly running a certain set of actions at regular time intervals. Obviously, this is a task for cron, right?

不幸的是,互联网似乎在那里有点不一致。

Unfortunately, the Internet seems to be in a bit of disagreement there.

让我详细介绍一下我的设置。首先,我的开发环境在Windows中,而我的生产环境托管在 Webfaction (Linux )。 Windows上没有真正的cron,对吧?此外,我使用 Django ! Django有什么建议?

Let me elaborate a little about my setup. First, my development environment is in Windows, while my production environment is hosted on Webfaction (Linux). There is no real cron on Windows, right? Also, I use Django! And what's suggested for Django?

芹菜 当然!不幸的是,设置Celery对于我来说已经或多或少是一个字面上的噩梦 - 请参阅错误消息没有找到记录器的处理程序多处理使用芹菜 。这只是我与芹菜有关的一个问题。其他的包括一个套接字错误,我是唯一一个有问题的人。

Celery of course! Unfortunately, setting up Celery has been more or less a literal nightmare for me - please see Error message 'No handlers could be found for logger "multiprocessing"' using Celery. And this is only ONE of the problems I've had with Celery. Others include a socket error which it I'm the only one ever to have gotten the problem.

不要误会我,芹菜似乎真的很酷。不幸的是,似乎缺乏支持,并且其首选后端中存在一些奇怪的限制, RabbitMQ 。不幸的是,无论程序如何,如果它不起作用,那么它不起作用。

Don't get me wrong, Celery seems REALLY cool. Unfortunately, there seems to be a lack of support, and some odd limitations built into its preferred backend, RabbitMQ. Unfortunately, no matter how cool a program is, if it doesn't work, well, it doesn't work!

这就是我希望你们能进来的地方我想知道有关cron或cron的等效项,可以在Windows和Linux环境中进行类似的设置(最好相同)。

That's where I hope all of you can come in. I'd like to know about cron or a cron-equivalent, which can be set up similarly (preferably identically) in both a Windows and a Linux environment.

我已经和芹菜一起奋斗了大概两个星期了,不幸的是我认为现在是时候扔毛巾,放弃了,至少现在。)

(I've been struggling with Celery for about two weeks now and unfortunately I think it's time to toss in the towel and give up on it, at least for now.)

推荐答案

一个简单的,非Celery的方法来处理事情将是创建 Django自定义管理命令执行异步或计划任务。

A simple, non-Celery way to approach things would be to create Django custom management commands to perform your asynchronous or scheduled tasks.

然后,在Windows上,您可以使用 / code>命令来安排这些任务。在Linux上,您使用 cron

Then, on Windows, you use the at command to schedule these tasks. On Linux, you use cron.

如果可以用于开发环境,我也强烈建议您将Windows 。在Linux或甚至Mac OSX上,你的生活会更好一些。重新使用Ubuntu的备用或旧机器,或在Windows机箱的虚拟机中运行Ubuntu。

I'd also strongly recommend ditching Windows if you can for a development environment. Your life will be so much better on Linux or even Mac OSX. Re-purpose a spare or old machine with Ubuntu for example, or run Ubuntu in a VM on your Windows box.

这篇关于安排常规事件:Cron / Cron替代品(包括Celery)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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