启动 Worker 服务
用于消费异步队列任务,如知识库文件导入、更新知识库文档等异步操作。 Linux / MacOS 启动:
Copypoetry run celery -A app.celery worker -P gevent -c 1 -Q dataset,generation,mail,ops_trace --loglevel INFO
如果使用 Windows 系统启动,请替换为该命令:
Copypoetry run celery -A app.celery worker -P solo --without-gossip --without-mingle -Q dataset,generation,mail,ops_trace --loglevel INFO
正确输出:
Copy -------------- celery@TAKATOST.lan v5.2.7 (dawn-chorus) --- ***** ----- -- ******* ---- macOS-10.16-x86_64-i386-64bit 2023-07-31 12:58:08 - *** --- * --- - ** ---------- [config] - ** ---------- .> app: app:0x7fb568572a10 - ** ---------- .> transport: redis://:**@localhost:6379/1 - ** ---------- .> results: postgresql://postgres:**@localhost:5432/dify - *** --- * --- .> concurrency: 1 (gevent) -- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker) --- ***** ----- -------------- [queues] .> dataset exchange=dataset(direct) key=dataset .> generation exchange=generation(direct) key=generation .> mail exchange=mail(direct) key=mail [tasks] . tasks.add_document_to_index_task.add_document_to_index_task . tasks.clean_dataset_task.clean_dataset_task . tasks.clean_document_task.clean_document_task . tasks.clean_notion_document_task.clean_notion_document_task . tasks.create_segment_to_index_task.create_segment_to_index_task . tasks.deal_dataset_vector_index_task.deal_dataset_vector_index_task . tasks.document_indexing_sync_task.document_indexing_sync_task . tasks.document_indexing_task.document_indexing_task . tasks.document_indexing_update_task.document_indexing_update_task . tasks.enable_segment_to_index_task.enable_segment_to_index_task . tasks.generate_conversation_summary_task.generate_conversation_summary_task . tasks.mail_invite_member_task.send_invite_member_mail_task . tasks.remove_document_from_index_task.remove_document_from_index_task . tasks.remove_segment_from_index_task.remove_segment_from_index_task . tasks.update_segment_index_task.update_segment_index_task . tasks.update_segment_keyword_index_task.update_segment_keyword_index_task [2023-07-31 12:58:08,831: INFO/MainProcess] Connected to redis://:**@localhost:6379/1 [2023-07-31 12:58:08,840: INFO/MainProcess] mingle: searching for neighbors [2023-07-31 12:58:09,873: INFO/MainProcess] mingle: all alone [2023-07-31 12:58:09,886: INFO/MainProcess] pidbox: Connected to redis://:**@localhost:6379/1. [2023-07-31 12:58:09,890: INFO/MainProcess] celery@TAKATOST.lan ready.