Skip to main content

maybe_patch_concurrency

Apply eventlet/gevent monkeypatches.

With short and long opt alternatives that specify the command line option to set the pool, this makes sure that anything that needs to be patched is completed as early as possible. (e.g., eventlet/gevent monkey patches).

def maybe_patch_concurrency(
argv: list = sys.argv,
short_opts: list = ['-P'],
long_opts: list = ['--pool'],
patches: dict = {'eventlet': _patch_eventlet, 'gevent': _patch_gevent}
) - > null

Apply eventlet/gevent monkeypatches. With short and long opt alternatives that specify the command line option to set the pool, this makes sure that anything that needs to be patched is completed as early as possible. (e.g., eventlet/gevent monkey patches).

Parameters

NameTypeDescription
argvlist = sys.argvThe list of command-line arguments to parse for pool selection.
short_optslist = ['-P']A list of short-form command-line flags used to identify the concurrency pool.
long_optslist = ['--pool']A list of long-form command-line flags used to identify the concurrency pool.
patchesdict = {'eventlet': _patch_eventlet, 'gevent': _patch_gevent}A mapping of pool names to their respective patching functions.

Returns

TypeDescription
nullNothing is returned; the function performs side-effect monkeypatching and environment setup.