如何列出 celery中排队的物品?

发布于 2021-01-29 16:57:22

我在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.

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

关注者
0
被浏览
32
1 个回答
  • 面试哥
    面试哥 2021-01-29
    为面试而生,有面试问题,就找面试哥。

    如果您想获取所有预定任务,

    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
    


知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看