celery 2.x @periodic_task 未显示在任务注册表中

发布于 2024-09-24 05:50:47 字数 346 浏览 3 评论 0原文

我最近更新到了 celery 2.0,我正在尝试使用新的(对我来说)装饰器来执行定期任务:

@periodic_task(run_every=timedelta(days=1))
def some_task(**kwargs):
    #task here

我的网站上还有一些其他代码,其中列出了定期任务以及它们运行的​​频率

from celery.registry import tasks

以获取列表任务。我的问题是使用装饰器添加的任务似乎没有显示在这个任务列表中。有没有办法获取使用 celery 2.0 中的装饰器添加的任务列表?

I've recently updated to celery 2.0 and I'm trying to use the new (to me) decorators for periodic tasks:

@periodic_task(run_every=timedelta(days=1))
def some_task(**kwargs):
    #task here

I also have some other code is my site that lists periodic tasks and how often they run using

from celery.registry import tasks

to get the list of tasks. My issue is that tasks added using the decorator don't seem to show up in this list of tasks. Is there a way to get a list of tasks added using the decorators in celery 2.0?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文