How to use the loky.backend.context function in loky

To help you get started, we’ve selected a few loky examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qucontrol / krotov / src / krotov / parallelization.py View on Github external
This function should only be called once per script/notebook, at its
        very beginning. The :obj:`USE_LOKY` and :obj:`USE_THREADPOOL_LIMITS`
        variables may be set at any time.
    """
    global USE_LOKY
    start_methods = ['fork', 'spawn', 'forkserver']
    if use_loky:
        start_methods.extend(['loky', 'loky_int_main'])
    if start_method is not None:
        if start_method not in start_methods:
            raise ValueError("start_method not in %s" % str(start_methods))
    if use_loky:
        if not _HAS_LOKY:
            raise ImportError("The loky library is not installed.")
        USE_LOKY = True
        loky.backend.context.set_start_method(start_method)
        if loky_pickler is not None:
            loky.set_loky_pickler(loky_pickler)
    else:
        multiprocessing.set_start_method(start_method)

loky

A robust implementation of concurrent.futures.ProcessPoolExecutor

BSD-3-Clause
Latest version published 1 year ago

Package Health Score

68 / 100
Full package analysis