运行 eventlet 池时,Celery 会自动进行 Monkey Patch 吗?

Does Celery Automatically Monkey Patch when running eventlet pool?

这是来自邮件列表的交叉post,希望能引起更多关注。 (original post)

当使用 运行 celery worker -p eventlet 时,Celery 会自动对我的代码进行猴子修补吗?

补丁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). The example hints自动完成,但没有explicit/definite答案。

当您 运行 celery worker 函数 execute_from_commandline calls celery.__init__.maybe_patch_concurrency which calls _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)