首页 > 解决方案 > Celery --pool=threads -- 这是做什么的以及如何正确使用它?

问题描述

我在使用 Celery 运行任务时遇到了段错误。查找问题后,似乎其他人正在通过使用--pool=threads.

当我尝试通过时,--pool=threads我得到ModuleNotFoundError: No module named 'threads'

我不相信这thread与会引发错误的模块相同No module named 'thread'

我如何开始使用线程,它有什么作用?

Celery 站点中的相关文档--pool=threads非常少。搜索“--pool”不会返回任何实质性内容,除了与台球有关的内容

标签: pythonmultithreadingcelery

解决方案


如果你想使用线程作为你的执行池,你可以在 eventlet 和 gevent 之间进行选择。

http://docs.celeryproject.org/en/latest/reference/celery.bin.worker.html#cmdoption-celery-worker-p

您需要使用pip installeventlet/gevent 才能使其工作。


推荐阅读