简体   繁体   中英

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?

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). 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:

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM