def monitor_exception()

in azure/datalake/store/multiprocessor.py [0:0]


def monitor_exception(exception_queue, process_ids):
    global GLOBAL_EXCEPTION
    logger = logging.getLogger("azure.datalake.store")

    while True:
        try:
            local_exception = exception_queue.get(timeout=0.1)
            if local_exception == END_QUEUE_SENTINEL:
                break
            logger.log(logging.DEBUG, "Setting global exception")
            GLOBAL_EXCEPTION_LOCK.acquire()
            GLOBAL_EXCEPTION = local_exception
            GLOBAL_EXCEPTION_LOCK.release()
            logger.log(logging.DEBUG, "Closing processes")
            for p in process_ids:
                p.terminate()
            logger.log(logging.DEBUG, "Joining processes")
            for p in process_ids:
                p.join()

            logger.log(logging.DEBUG, "Interrupting main")
            raise Exception(local_exception)
        except Empty:
            pass