# Path: core/conf/constants.py
# TASK_EXPIRATION = 60  # seconds
# 
# Path: core/conf/logconfig.py
# LOG_FORMAT = '%(asctime)s %(name)s[%(process)d] %(levelname)s %(message)s'
# LOG_LEVELS = {
#     'info': logging.INFO,
#     'warning': logging.WARNING,
#     'error': logging.ERROR,
#     'debug': logging.DEBUG,
# }
# HIDDEN_ALL = ['warnings', 'stdout', 'stderr', 'running']
# HIDDEN_KEEP_STDERR = ['warnings', 'stdout', 'running']
# def set_logging(lvl='info'):


import dill
import os
import signal
import time
from datetime import datetime, timedelta
from multiprocessing import TimeoutError
from core.conf.constants import TASK_EXPIRATION
from core.conf.logconfig import logger
                    if path is not None else []

    def run(self, *args, **kwargs):
        return self.command(*args, **kwargs)


class MultiprocessedCommand(DefaultCommand):
    """
    This class handles command multi-processing and is to be attached to a console through its constructor's
     arguments.
    """
    is_multiprocessed = True

    def __init__(self, console, command, name, path):
        super(MultiprocessedCommand, self).__init__(console, command, name, path)
        self.pool = console.pool
        self.task = None
        self.tasklist[self] = {
            'name': name,
            'command': self.command.__name__,
            'status': 'INIT',
            'expires': None,
            'result': 'Not defined yet',
        }

    def __str__(self):
        return '{}[{}]'.format(self.name, self.command.__name__.lstrip('_'))

    def __set_info(self, status, result=None, expires=True):
        if status != 'PENDING':

# Path: core/conf/constants.py
# TASK_EXPIRATION = 60  # seconds
# 
# Path: core/conf/logconfig.py
# LOG_FORMAT = '%(asctime)s %(name)s[%(process)d] %(levelname)s %(message)s'
# LOG_LEVELS = {
#     'info': logging.INFO,
#     'warning': logging.WARNING,
#     'error': logging.ERROR,
#     'debug': logging.DEBUG,
# }
# HIDDEN_ALL = ['warnings', 'stdout', 'stderr', 'running']
# HIDDEN_KEEP_STDERR = ['warnings', 'stdout', 'running']
# def set_logging(lvl='info'):


# Path: core/utils/behaviors.py
import dill
import os
import signal
import time
from datetime import datetime, timedelta
from multiprocessing import TimeoutError
from core.conf.constants import TASK_EXPIRATION
from core.conf.logconfig import logger

                    if path is not None else []

    def run(self, *args, **kwargs):
        return self.command(*args, **kwargs)


class MultiprocessedCommand(DefaultCommand):
    """
    This class handles command multi-processing and is to be attached to a console through its constructor's
     arguments.
    """
    is_multiprocessed = True

    def __init__(self, console, command, name, path):
        super(MultiprocessedCommand, self).__init__(console, command, name, path)
        self.pool = console.pool
        self.task = None
        self.tasklist[self] = {
            'name': name,
            'command': self.command.__name__,
            'status': 'INIT',
            'expires': None,
            'result': 'Not defined yet',
        }

    def __str__(self):
        return '{}[{}]'.format(self.name, self.command.__name__.lstrip('_'))

    def __set_info(self, status, result=None, expires=True):
        if status != 'PENDING':

            logger.debug(' > Process {} is over.'.format(self))