[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選項指定要清除的隊列:html
$ celery -A proj purge -Q celery,foo,bar
並使用-X選項排除清除隊列:node
$ celery -A proj purge -X celeryredis
celery -A tasks inspect activeshell
celery -A tasks inspect scheduledbash
這些是設置了eta或countdown參數時由工做人員保留的任務 。app
這將列出工做者已經預取的全部任務,而且當前正在等待執行(不包括設置了ETA值的任務)。ide
$ celery -A tasks inspect revokedui
celery -A tasks inspect query_task task_idthis
celery -A tasks control enable_events/disable_eventsspa
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,查看任務結果