# Path: aql/utils/aql_logging.py
# LOG_CRITICAL = logging.CRITICAL
# LOG_ERROR = logging.ERROR
# LOG_WARNING = logging.WARNING
# LOG_INFO = logging.INFO
# LOG_DEBUG = logging.DEBUG
# class LogFormatter(logging.Formatter):
#     def __init__(self, *args, **kw):
#     def format(self, record):
# def _make_aql_logger():


import threading
import traceback
    import queue
    import Queue as queue  # python 2
from .aql_logging import log_warning

        num_threads = len(self.threads)

        self.stop()
        if self.fail_event.is_set():
            return

        self.task_lock = _SharedLock()
        self.start(num_threads)

    # ----------------------------------------------------------

    def add_expensive_task(self, task_id, function, *args, **kw):
        task = _ExpensiveTask(task_id, function, args, kw)

        self.enable_expensive()

        self.__add_task(task)

    # -----------------------------------------------------------

    def fail_handler(self, task_result, ex):
        if self.with_backtrace:
            err = traceback.format_exc()
        else:
            err = str(ex)

        if task_result is not None:
            task_result.error = err
        else:

# Path: aql/utils/aql_logging.py
# LOG_CRITICAL = logging.CRITICAL
# LOG_ERROR = logging.ERROR
# LOG_WARNING = logging.WARNING
# LOG_INFO = logging.INFO
# LOG_DEBUG = logging.DEBUG
# class LogFormatter(logging.Formatter):
#     def __init__(self, *args, **kw):
#     def format(self, record):
# def _make_aql_logger():


# Path: aql/utils/aql_task_manager.py
import threading
import traceback
    import queue
    import Queue as queue  # python 2
from .aql_logging import log_warning


        num_threads = len(self.threads)

        self.stop()
        if self.fail_event.is_set():
            return

        self.task_lock = _SharedLock()
        self.start(num_threads)

    # ----------------------------------------------------------

    def add_expensive_task(self, task_id, function, *args, **kw):
        task = _ExpensiveTask(task_id, function, args, kw)

        self.enable_expensive()

        self.__add_task(task)

    # -----------------------------------------------------------

    def fail_handler(self, task_result, ex):
        if self.with_backtrace:
            err = traceback.format_exc()
        else:
            err = str(ex)

        if task_result is not None:
            task_result.error = err
        else:

            log_warning("Internal task failed with error: %s", err)