Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一些模块有时是从 eventlet 环境中导入的,有时是从常规 python 环境中导入的。我想检测到这一点,以便有条件地调用monkey_patch和debug.hub_blocking_detection。
monkey_patch
debug.hub_blocking_detection
一段python代码是否有可靠的方法来发现它是否在eventlet环境中运行?
这是 Kombu/Celery 使用的:https ://github.com/ask/kombu/blob/master/kombu/syn.py