INNER CODE UNIT · Python

_max_workers

python-cachier/cachier · src/cachier/core.py:96

def _max_workers():
    return int(os.environ.get(MAX_WORKERS_ENVAR_NAME, DEFAULT_MAX_WORKERS))


def _set_max_workers(max_workers):
    os.environ[MAX_WORKERS_ENVAR_NAME] = str(max_workers)
    _get_executor(True)


def _get_executor(reset=False):
    if reset or not hasattr(_get_executor, "executor"):
        _get_executor.executor = ThreadPoolExecutor(_max_workers())
    return _get_executor.executor


def _function_thread(core: _BaseCore, key, func, args, kwds):
    try:
        func_res = func(*args, **kwds)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…