How can to run task in 5 minutes after finish prev

2020-07-30 03:23发布

问题:

I have a two tasks - a and b.

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

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

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

回答1:

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.