使用celery-beat完成上一个任务后5分钟内如何运行任务? [英] How can to run task in 5 minutes after finish previous task using celery-beat?

查看:240
本文介绍了使用celery-beat完成上一个任务后5分钟内如何运行任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个任务- a b

任务 a 在完成上一个任务 a 后的5分钟内运行。

Task a running in 5 minutes after finish previous task a.

任务 b 在完成上一个任务 b 后的3分钟内运行。

Task b running in 3 minutes after finish previous task b.

如何实施?我正在使用 python 3.6.8 Django 2.2.6 celery 4.3.0

How can I implement it? I'm use python 3.6.8, Django 2.2.6 and celery 4.3.0?

推荐答案

简短的答案是您不能用芹菜拍子做这件事,因为芹菜拍子将触发任务开始而不是任务结束。如果绝对需要在上一个任务结束后三分钟执行此操作,建议您在两个<$ c $的末尾添加对 .apply_async 的调用c> a 和 b 并启动每个任务一次。

The short answer is that you can't do this with celery beat because celery beat will trigger off of task start and not at task end. If you absolutely need to do it three minutes after the previous task ends, you'd be advised to just adding a call to .apply_async at the end of both a and b and kicking off each task once.

这篇关于使用celery-beat完成上一个任务后5分钟内如何运行任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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