python - 如何列出 celery 中的排队项目?

标签 python django celery

我在 Ubuntu EC2 节点上有一个 Django 项目,我一直使用它来使用 Celery 设置异步。

我正在关注 http://michal.karzynski.pl/blog/2014/05/18/setting-up-an-asynchronous-task-queue-for-django-using-celery-redis/连同文档。

我已经能够在命令行上完成一项基本任务,使用:

(env1)ubuntu@ip-172-31-22-65:~/projects/tp$ celery --app=myproject.celery:app worker --loglevel=INFO

我刚刚意识到,我的队列中有一堆任务尚未执行:

[2015-03-28 16:49:05,916: WARNING/MainProcess] Restoring 4 unacknowledged message(s).
(env1)ubuntu@ip-172-31-22-65:~/projects/tp$ celery -A tp purge
WARNING: This will remove all tasks from queue: celery.
         There is no undo for this operation!

(to skip this prompt use the -f option)

Are you sure you want to delete all tasks (yes/NO)? yes
Purged 81 messages from 1 known task queue.

如何从命令行获取排队项目的列表?

最佳答案

如果要获取所有定时任务,

celery inspect scheduled

查找所有事件队列

celery inspect active_queues

状态

celery inspect stats

对于所有命令

celery inspect

如果你想明确地得到它。因为你正在使用 redis 作为队列。那么

redis-cli

>KEYS * #find all keys

然后找出与celery相关的东西

>LLEN KEY # i think it gives length of list

关于python - 如何列出 celery 中的排队项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29319889/

相关文章:

python - 从证书中提取公钥并加密数据

python - PyQt - 不希望无模式对话框总是在最前面

python - 如何在C中打印多行

同一 AWS 实例上的 Django Rest Framework 和 Angular 应用程序

python - celery task_success 与发件人过滤器

python - 在一个线程中创建的 DatabaseWrapper 对象只能在同一个线程中使用。”尝试使用 celery 插入数据库时

python - Django密码更改:Reverse for '<function password_change_done at 0xa3b0f0c>' with arguments '()' and keyword arguments '{}' not found

python - 如何通过外键访问模型的 __str__ 方法?

python - __init__ 形式 Django 中的查询集

python - RabbitMQ/Celery(事件): Server unexpectedly closed connection