计划定期活动:Cron / Cron替代品(包括Celery) [英] Scheduling a regular event: Cron/Cron alternatives (including Celery)

查看:400
本文介绍了计划定期活动: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 。这只是我用芹菜的问题之一。其他包括一个套接字错误,它是我唯一的一个已经得到的问题。

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.

我也强烈建议您在开发环境。你的生活将在Linux或甚至Mac OSX上好多了。例如,使用Ubuntu重新使用备用或旧机器,或在Windows框中的VM中运行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天全站免登陆