简体   繁体   English

运行事件let池时,芹菜会自动猴子修补吗?

[英]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.

相关问题 eventlet是否为线程模块做Monkey_patch? - Does eventlet do monkey_patch for threading module? 为什么Eventlet补丁修复了Celery任务中的requests.post? - Why does Eventlet patch fix requests.post in Celery task? gunicorn + gevent monkey修补threadlocals会自动成为greenlet-locals吗? - Does gunicorn + gevent monkey patch threadlocals to be greenlet-locals automatically? 如果代码中有eventlet.monkey_patch(),则无法远程调试? - Can not remote debug if there is eventlet.monkey_patch() in code? APScheduler任务由于eventlet monkey_patch而无法触发 - APScheduler task not firing due to eventlet monkey_patch monkey_patch(time=True) 如何影响 eventlet.spawn? - How monkey_patch(time=True) affects eventlet.spawn? python eventlet结构给出IOError:[Errno 1]运行celery worker时不允许操作 - python eventlet fabric gives IOError: [Errno 1] Operation not permitted when running celery worker 我应该在 celery 中使用 prefork、eventlet 或 gevent 哪个池类? - Which pool class should i use prefork, eventlet or gevent in celery? eventlet.monkey_patch()引发异常:SECRET_KEY设置不能为空 - eventlet.monkey_patch() throws an exception: The SECRET_KEY setting must not be empty 使用opensl的​​apns_client在eventlet.monkey_patch()上失败 - apns_client which usese openssl fails on eventlet.monkey_patch()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM