如何获取 My Celery 应用程序处理的任务数
我有一个使用 redis 作为代理的 Celery 应用程序,我可以使用以下命令获取应用程序的统计信息
celery -A test.celeryappspect stats
这给了我一些如下所示的
"total": {
"test.celerytasks._generate_data": 14493666,
"test.celerytasks.cleanup_data": 14493,
}
数字这些数字说明这些任务从第一天起执行了这么多次?如何理解这些结果
我应该如何获取过去 1 小时/天处理的 celery 任务数量?我可以获取最近一小时/天的过期任务列表吗?
有没有可行性来实现这个目标?
I've a Celery App which is using redis as a broker and I can fetch the stats of the app using the below command
celery -A test.celeryapp inspect stats
This is giving me some numbers like below
"total": {
"test.celerytasks._generate_data": 14493666,
"test.celerytasks.cleanup_data": 14493,
}
Are these numbers describe that these tasks got executed this many number of times from day1? How to understand these results
How should I get the number of celery tasks which were processed in the last 1 hour/day? Can I get the list of expired tasks in the last one hour/day?
Is there any feasibility to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些数字是上次重新启动 celery 时的总数。本质上,每个节点上的每个工作人员都会跟踪每个任务的自己的统计信息,然后将其报告回检查命令,然后检查命令将汇总结果。
您可以在持久模式下运行flower并检查保存的状态数据库
These numbers are the total from the last time celery was restarted. Essentially, each worker on each node keeps track of its own stats per task and then reports that back to the inspect command, which will then aggregate the results.
You can run flower in persistent mode and check the saved state db