[root@node2 app]# celery -A tasks shell Python 3.6.5 (default, Oct 23 2019, 12:55:54) Type ‘copyright‘, ‘credits‘ or ‘license‘ for more information IPython 7.8.0 -- An enhanced Interactive Python. Type ‘?‘ for help. In [1]: app Out[1]: <Celery tasks at 0x7ff7dddbdc18> In [2]: add.delay(1,2) Out[2]: <AsyncResult: c5cfd00f-8b11-4408-95e2-241f2f3d5521>
[root@node2 app]# celery -A tasks result c5cfd00f-8b11-4408-95e2-241f2f3d5521 3
[root@node2 app]# celery -A tasks 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 No messages purged from 1 queue
您还可以使用-Q选项指定要清除的队列:
$ celery -A proj purge -Q celery,foo,bar
并使用-X选项排除清除队列:
$ celery -A proj purge -X celery
celery -A tasks inspect active
celery -A tasks inspect scheduled
这些是设置了eta或countdown参数时由工作人员保留的任务 。
这将列出工作者已经预取的所有任务,并且当前正在等待执行(不包括设置了ETA值的任务)。
$ celery -A tasks inspect revoked
celery -A tasks inspect query_task task_id
celery -A tasks control enable_events/disable_events
pip install flower
celery -A tasks flower
可以添加--port参数指定监听端口,默认监听5555
或者通过指定Broker URL
$ celery flower --broker=amqp://guest:guest@localhost:5672// or $ celery flower --broker=redis://guest:guest@localhost:6379/0
celery -A tasks events
可以看件如下界面:
按j,k键可以选中task,查看任务结果
原文:https://www.cnblogs.com/zydev/p/11739007.html