eventletutils

Eventlet utils helper module.

New in version 1.3.

oslo_utils.eventletutils.fetch_current_thread_functor()

Get the current thread.

If eventlet is used to monkey-patch the threading module, return the current eventlet greenthread. Otherwise, return the current Python thread.

New in version 1.5.

oslo_utils.eventletutils.is_monkey_patched(module)

Determines safely is eventlet patching for module enabled or not :param module: String, module name :return Bool, True if module is patched, False otherwise

oslo_utils.eventletutils.warn_eventlet_not_patched(expected_patched_modules=None, what='this library')

Warns if eventlet is being used without patching provided modules.

Parameters:
  • expected_patched_modules (list/tuple/iterable) – list of modules to check to ensure that they are patched (and to warn if they are not); these names should correspond to the names passed into the eventlet monkey_patch() routine. If not provided then all the modules that could be patched are checked. The currently valid selection is one or multiple of [‘MySQLdb’, ‘__builtin__’, ‘all’, ‘os’, ‘psycopg’, ‘select’, ‘socket’, ‘thread’, ‘time’] (where ‘all’ has an inherent special meaning).
  • what (string) – string to merge into the warnings message to identify what is being checked (used in forming the emitted warnings message).