I have some modules which are sometimes imported from within an eventlet environment, and sometimes from a regular python environment. I would like to detect this so that I can conditionally invoke things like monkey_patch
and debug.hub_blocking_detection
.
Is there a reliable way for a piece of python code to discover whether it's running in an eventlet environment?
This is what Kombu/Celery uses: https://github.com/ask/kombu/blob/master/kombu/syn.py