加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – 运行eventlet池时Celery是否自动运行Monkey Patch?

发布时间:2020-12-16 22:52:57 所属栏目:Python 来源:网络整理
导读:这是来自邮件列表的交叉帖子,希望能够更多地关注这个问题. (original post) 当使用运行celery worker -p eventlet时,Celery会自动对我的代码进行猴子修补吗? docs没有提到任何关于必须进行修补的事情,official example也没有做任何明确的修补(即使gevent ex

这是来自邮件列表的交叉帖子,希望能够更多地关注这个问题. (original post)

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

docs没有提到任何关于必须进行修补的事情,official example也没有做任何明确的修补(即使gevent example也没有进行任何修补).修补程序自动完成示例hints,但没有明确/明确的答案.

最佳答案
当您运行芹菜工作时,函数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)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读