Celery --pool=threads -- 这是做什么的,我该如何正确使用它?
Celery --pool=threads -- what does this do and how do I use it properly?
我在 运行 使用 Celery 的任务中遇到段错误。查找问题后,似乎其他人正在通过使用 --pool=threads
启动芹菜来解决类似问题。
当我尝试通过 --pool=threads
我得到 ModuleNotFoundError: No module named 'threads'
我认为这与 thread
模块不同,后者会抛出 No module named 'thread'
的错误。
如何开始使用线程以及它有什么作用?
Celery 站点中关于 --pool=threads
的文档非常少。搜索“--pool”将 return 除了与台球相关的内容之外没有任何实质内容
如果您想使用线程作为执行池,您可以在 eventlet 和 gevent 之间进行选择。
http://docs.celeryproject.org/en/latest/reference/celery.bin.worker.html#cmdoption-celery-worker-p
您需要 pip install
eventlet/gevent 才能正常工作。
刚刚发布的 Celery 4.4.0 添加 --pool thread
到并发列表。
您可以在 Celery 4.4 Changelogs 阅读更多内容:
Threaded Tasks Pool
We reintroduced a threaded task pool using
concurrent.futures.ThreadPoolExecutor.
The previous threaded task pool was experimental. In addition it was based on the threadpool package which is obsolete.
You can use the new threaded task pool by setting worker_pool to ‘threads` or by passing –pool threads to the celery worker command.
现在您可以使用线程而不是进程来进行池化。
celery worker -A your_application --pool threads --loginfo=INFO
我在 运行 使用 Celery 的任务中遇到段错误。查找问题后,似乎其他人正在通过使用 --pool=threads
启动芹菜来解决类似问题。
当我尝试通过 --pool=threads
我得到 ModuleNotFoundError: No module named 'threads'
我认为这与 thread
模块不同,后者会抛出 No module named 'thread'
的错误。
如何开始使用线程以及它有什么作用?
Celery 站点中关于 --pool=threads
的文档非常少。搜索“--pool”将 return 除了与台球相关的内容之外没有任何实质内容
如果您想使用线程作为执行池,您可以在 eventlet 和 gevent 之间进行选择。
http://docs.celeryproject.org/en/latest/reference/celery.bin.worker.html#cmdoption-celery-worker-p
您需要 pip install
eventlet/gevent 才能正常工作。
刚刚发布的 Celery 4.4.0 添加 --pool thread
到并发列表。
您可以在 Celery 4.4 Changelogs 阅读更多内容:
Threaded Tasks Pool
We reintroduced a threaded task pool using concurrent.futures.ThreadPoolExecutor.
The previous threaded task pool was experimental. In addition it was based on the threadpool package which is obsolete.
You can use the new threaded task pool by setting worker_pool to ‘threads` or by passing –pool threads to the celery worker command.
现在您可以使用线程而不是进程来进行池化。
celery worker -A your_application --pool threads --loginfo=INFO