Celery,Django..制作任务/线程启动子任务/线程?

发布于 2024-09-26 06:54:22 字数 330 浏览 9 评论 0原文

我正在将 celery 与 django 一起使用,并尝试获取一个任务,如下所示:

class task1 (Task)
   def run (self):
      launch_some_other_task.delay()

但它似乎不起作用,我可以详细了解我的代码,但我想我会先问是否这某种事情会起作用,但似乎对我不起作用。我发现这是必要的,因为我正在使用 selenium,一个网络测试框架,有时它会挂在我无法从中获得任何输出的地方,所以我希望能够在不满足某个条件时杀死 if off (在指定秒数内用特定值更新内存缓存变量)。

感谢您对此的任何建议

I'm using celery with django and am trying to get a Task, like the one below:

class task1 (Task)
   def run (self):
      launch_some_other_task.delay()

But it doesn't seem to be working, I can go into more detail as far as my code but figured I would just ask first if this sort of thing will work as doesn't seem to be working for me. I am finding this necessary as I am using selenium, a web testing framework, where sometimes it will just hang where I can't get any output from this so I want to be able to kill if off if a certain condition isn't met (updating a memcache variable with a certain value within a specified number of seconds).

Thanks for any advice on this

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

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

发布评论

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

评论(1

岁月染过的梦 2024-10-03 06:54:22

确保您已将以下内容添加到 urls.py 中:

import djcelery
djcelery.setup_loader()

Make sure you've added the following to your urls.py:

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