简体   繁体   English

如果未在一定时间内执行任务,则如何为任务设置时间限制,然后将其移至芹菜中

[英]How to set a time limit to a task if not excute within a certain time then just remove it in celery

I'm using celery(rabbitmq as broker) to do many tasks every minute.Since the task is a little time-consuming, the tasks in the queue may accumulate which leads to the newest come task not excute in time. 我正在使用celery(rabbitmq作为代理)每分钟执行许多任务。由于该任务比较耗时,因此队列中的任务可能会堆积起来,从而导致最新任务无法及时执行。 How can I deal with it? 我该如何处理?

I think I find it in the document: 我想我在文档中找到了它:

Expiration 期满

add.apply_async(args=[10, 10], expires=60)

Task Expires 任务到期

@task(expires=50)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM