[英]Does Celery Automatically Monkey Patch when running eventlet pool?
This is a cross-post from the mailing list, hoping to get more eyes on the question. 这是邮件列表中的交叉帖子,希望引起更多关注。 ( original post ) ( 原始帖子 )
When using running celery worker -p eventlet
, does Celery do automatic monkey-patching of my code? 使用正在运行的celery worker -p eventlet
,Celery是否自动对我的代码进行猴子修补?
The docs don't mention anything about having to do patching and the official example doesn't do any explicit patching as well (even the gevent example doesn't do any patching). 文档未提及必须进行修补的任何内容, 官方示例也未进行任何显式的修补(即使gevent示例也未进行任何修补)。 The example hints at patching being done automatically, but there is no explicit/definite answer. 该示例提示修补程序是自动完成的,但没有明确/确定的答案。
When you run celery worker
the function execute_from_commandline
calls celery.__init__.maybe_patch_concurrency
which calls _patch_eventlet
which does: 当您运行celery worker
,函数execute_from_commandline
调用celery.__init__.maybe_patch_concurrency
会调用_patch_eventlet
来执行以下操作:
def _patch_eventlet():
import eventlet
import eventlet.debug
eventlet.monkey_patch()
blockdetect = float(os.environ.get('EVENTLET_NOBLOCK', 0))
if blockdetect:
eventlet.debug.hub_blocking_detection(blockdetect, blockdetect)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.