如何知道事件组{task}在Celery中是启用还是禁用



在芹菜中,我们可以通过以下方式启用或禁用任务事件:

celery control -A proj enable_events

celery control -A proj enable_events

从运行此命令时,它会显示-task events already enabledtask events enabled

这表示任务的状态为启用或禁用事件。我想知道如何以编程方式获取is。

感谢

您可以使用如下所示的代码

app = Celery()
app.config_from_object('conf.config')
response = app.control.enable_events(reply=True)
# print response here

最新更新