Windows下Celery v4.3.0使用gevent时参数报错及并发数配置问题
解决Celery v4.3.0在Windows 10下结合gevent的并发配置问题
Got it, let's sort this out for you!
The issue with your original command is that you're trying to pass gevent as a standalone argument at the end, which Celery 4.x doesn't recognize anymore. Instead, you need to explicitly specify the pool type using the -P (or --pool) flag, and then pair it with the -c (or --concurrency) flag to set the number of concurrent greenlets.
Here's the correct command that combines both your requirements:
celery worker -A celery_blog -l info -P gevent -c 5
补充说明:
-P gevent告诉Celery使用gevent池来处理并发任务(考虑到你在Windows系统上,这是处理异步任务的合适选择)。-c 5将并发级别设置为5,意味着Celery会生成5个协程来同时处理任务。
如果你偏好更清晰的长格式参数(后续查看时更容易理解),也可以使用这种写法:
celery worker -A celery_blog --loglevel=info --pool=gevent --concurrency=5
这个命令完全适配你的环境(Windows 10 + Celery v4.3.0 + gevent),能解决你之前遇到的「unrecognized arguments」错误。
内容的提问来源于stack exchange,提问作者Azima
相关产品推荐
相关产品推荐

