芹菜 + Django:无法在 Windows 7 上启动 celerybeat

发布于 2024-12-24 04:06:42 字数 913 浏览 3 评论 0原文

我一直在开发 Django 应用程序,现在尝试添加 Celery 来执行后台任务。我需要将正常任务和定期任务排队。我可以很好地启动 celeryd,并用它执行任务(我使用命令 python manage.py celeryd start --settings=settings --loglevel=INFO 启动它)。

在 Windows 上,您无法执行 -beat/-b 来启用节拍模式;您需要将 celerybeat 作为单独的服务启动(这在 Celery 文档的常见问题解答部分中有说明)。如果我在命令行中输入此命令 - python manage.py celerybeat -s djcelery.schedulers.DatabaseScheduler --settings=settings --loglevel=INFO - 我会收到如下错误:

[2012-01-02 19:06:52,009: WARNING/MainProcess] ERROR: Pidfile (celerybeat.pid) a
lready exists.
Seems we're already running? (PID: 2364)
[2012-01-02 19:06:52,012: INFO/MainProcess] process shutting down

和 celerybeat从未真正开始。所以我无法执行任何定期任务...有什么想法吗?我只发现另一个页面有人突出显示了类似的错误,但没有解决方案被提供。

如果需要任何进一步的信息,请告诉我。我很困惑,因为我找不到有关这个主题的任何信息,今天我一整天都在尝试解决这个问题......谢谢。

I've been developing a Django application and I am now trying to add Celery for background tasks. I need both normal tasks and periodic tasks to be queued. I can start up celeryd just fine, and execute tasks with it (I start it with the command python manage.py celeryd start --settings=settings --loglevel=INFO).

On Windows you can't do -beat/-b to enable beat mode; you need to start celerybeat as a separate service (this is stated in the FAQ section of the Celery docs). If I type this into the command line -- python manage.py celerybeat -s djcelery.schedulers.DatabaseScheduler --settings=settings --loglevel=INFO -- I get an error like this:

[2012-01-02 19:06:52,009: WARNING/MainProcess] ERROR: Pidfile (celerybeat.pid) a
lready exists.
Seems we're already running? (PID: 2364)
[2012-01-02 19:06:52,012: INFO/MainProcess] process shutting down

and celerybeat never actually starts. So I can't execute any periodic tasks ... Any ideas? I only found one other page where somebody highlighted a similar error, but no solution was offered.

If there's any further information needed, please let me know. I'm baffled because I can't find any information on this subject, and I've been trying solve this problem all day today ... Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

究竟谁懂我的在乎 2024-12-31 04:06:42

在您的文件系统中搜索该 pid 文件并将其删除。在 UNIX 机器上,这通常意味着程序没有正确关闭。您应该检查它是否已经在任务管理器中运行,如果是,则将其杀死,然后删除该文件,

然后重试。

如果不存在 pid 文件,这可能意味着该软件存在问题,因为它可能是从 unix 移植的?

Search your file system for that pid file and delete it. On unix machines that usually means the program was not shut down correctly. You should check to see if its running in the task manager already, if so kill it, and delete that file

Then try again.

If there is no pid file present, that probably means there's an issue with the software as it was ported from unix perhaps?

心碎无痕… 2024-12-31 04:06:42

在我的 Windows 上的 django 项目中,该文件已经存在于 Django 项目的根目录中。我删除了该文件,并且该过程运行没有任何错误。
输入图像描述这里

“celerybeat.pid”已经存在,因为我从另一台 PC 运行 celerybeat 并将 git 存储库推送到云端。当我在工作 PC 上拉取存储库并运行该过程时,它给了我错误,引用了另一台 PC 之前创建的文件“celerybeat.pid”。删除“celerybeat.pid”使其工作。

In my case of django project on Windows this file was already existing in root of the Django project. I deleted that file and the process ran without any error.
enter image description here

The "celerybeat.pid" was already existing because I ran celery beat from another PC and pushed the git repo to the cloud. When I pulled the repo on my working PC and ran the process, it gave me error referring to the file "celerybeat.pid" created earlier by another PC. Deleting the "celerybeat.pid" made it work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文