eventletutils

Eventlet utils helper module.

Added in version 1.3.

class oslo_utils.eventletutils.EventletEvent(*args, **kwargs)

A class that provides consistent eventlet/threading Event API.

This wraps the eventlet.event.Event class to have the same API as the standard threading.Event object.

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.

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