简体   繁体   English

使用SQS撤销Celery任务

[英]Revoke Celery task with SQS

I am using Celery + Kombu with Amazon SQL. 我正在使用Celery + Kombu和Amazon SQL。 The goal is to be able to a remove a task already scheduled for some specific datetime. 目标是能够删除已安排在某个特定日期时间的任务。 I've tried 我试过了

from celery.task.control import revoke
revoke(task_id)

but that didn't change anything. 但这并没有改变任何事情。 Is revoke not implemented for SQS transport? 是否撤销未实施SQS传输? Is there some design decision behind it or it's just a lacking feature that should be implemented by some "DeleteMessage" line of code? 它背后是否有一些设计决策,或者只是缺少一些应该由一些“DeleteMessage”代码行实现的功能?

Unless you're using RabbitMQ, it's better to come up with a custom solution for revoking tasks. 除非您使用RabbitMQ,否则最好提出一个用于撤销任务的自定义解决方案。 Eg instead of executing tasks, build a system of two components: scheduler task that scans your table of potential tasks and executes them when time comes. 例如,不是执行任务,而是构建一个由两个组件组成的系统:调度程序任务,用于扫描潜在任务表并在时间到来时执行。 No need to revoke, you just can decide not to execute task when needed. 无需撤销,您可以决定在需要时不执行任务。

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

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