(call_queue, result_queue, initializer, initargs)
Evaluates calls from call_queue and places the results in result_queue.

    This worker is run in a separate process.

    Args:
        call_queue: A ctx.Queue of _CallItems that will be read and
            evaluated by the worker.
        result_queue: A ctx.Queue of _ResultItems that will written
            to by the worker.
        initializer: A callable initializer, or None
        initargs: A tuple of args for the initializer
Evaluates calls from call_queue and places the results in result_queue.
Evaluates calls from call_queue and places the results in result_queue .
def _process_worker(call_queue, result_queue, initializer, initargs):
    """Evaluates calls from call_queue and places the results in result_queue.

    This worker is run in a separate process.

    Args:
        call_queue: A ctx.Queue of _CallItems that will be read and
            evaluated by the worker.
        result_queue: A ctx.Queue of _ResultItems that will written
            to by the worker.
        initializer: A callable initializer, or None
        initargs: A tuple of args for the initializer
    """
    if initializer is not None:
        try:
            initializer(*initargs)
        except BaseException:
            _base.LOGGER.critical('Exception in initializer:', exc_info=True)
            # The parent will notice that the process stopped and
            # mark the pool broken
            return
    while True:
        call_item = call_queue.get(block=True)
        if call_item is None:
            # Wake up queue management thread
            result_queue.put(os.getpid())
            return
        try:
            r = call_item.fn(*call_item.args, **call_item.kwargs)
        except BaseException as e:
            exc = _ExceptionWithTraceback(e, e.__traceback__)
            _sendback_result(result_queue, call_item.work_id, exception=exc)
        else:
            _sendback_result(result_queue, call_item.work_id, result=r)
            del r

        # Liberate the resource as soon as possible, to avoid holding onto
        # open files or shared memory that is not needed anymore
        del call_item
def _process_worker ( call_queue , result_queue , initializer , initargs ) : if initializer is not None : try : initializer ( * initargs ) except BaseException : _base . LOGGER . critical ( 'Exception in initializer:' , exc_info = True ) # The parent will notice that the process stopped and # mark the pool broken return while True : call_item = call_queue . get ( block = True ) if call_item is None : # Wake up queue management thread result_queue . put ( os . getpid ( ) ) return try : r = call_item . fn ( * call_item . args , * * call_item . kwargs ) except BaseException as e : exc = _ExceptionWithTraceback ( e , e . __traceback__ ) _sendback_result ( result_queue , call_item . work_id , exception = exc ) else : _sendback_result ( result_queue , call_item . work_id , result = r ) del r # Liberate the resource as soon as possible, to avoid holding onto # open files or shared memory that is not needed anymore del call_item