# Path: src/myaas/settings.py
# DEBUG = config('MYAAS_DEBUG', default=False, cast=bool)
# 
# Path: src/myaas/utils/database.py
# def get_myaas_containers():
#     return filter(_is_database_container, list_containers())
# 
# def get_enabled_backend():
#     return importlib.import_module(settings.BACKEND)
# 
# Path: src/myaas/utils/container.py
# def find_container(name):
# def list_containers(all=True):
# def translate_host_basedir(path):
# def get_random_cpuset(cores_to_assign):
# def get_mapped_cpuset():


import signal
import logging
import click
from time import sleep
from datetime import datetime
from .settings import DEBUG
from .utils.database import get_myaas_containers, get_enabled_backend
from .utils.container import client
        self.__killed = True


class ContainerFilter(object):
    def __init__(self, expired=False, dead=False, unhealthy=False):
        self._expired = expired
        self._dead = dead
        self._unhealthy = unhealthy

    def filter(self, containers):
        if self._expired:
            logger.info('* Filtering expired')
        if self._dead:
            logger.info('* Filtering exited')
        if self._unhealthy:
            logger.info('* Filtering unhealthy')
        return filter(self._is_removable, containers)

    def _is_removable(self, container):
        name = get_container_name(container)
        if self._expired and self._is_expired(container):
            logger.info("%s is expired, queued for deletion", name)
            return True

        if self._dead and self._is_dead(container):
            logger.info("%s is dead, queued for deletion", name)
            return True

        if self._unhealthy and self._is_unhealthy(container):
            logger.info("%s is unhealthy, queued for deletion", name)

# Path: src/myaas/settings.py
# DEBUG = config('MYAAS_DEBUG', default=False, cast=bool)
# 
# Path: src/myaas/utils/database.py
# def get_myaas_containers():
#     return filter(_is_database_container, list_containers())
# 
# def get_enabled_backend():
#     return importlib.import_module(settings.BACKEND)
# 
# Path: src/myaas/utils/container.py
# def find_container(name):
# def list_containers(all=True):
# def translate_host_basedir(path):
# def get_random_cpuset(cores_to_assign):
# def get_mapped_cpuset():


# Path: src/myaas/reaper.py
import signal
import logging
import click
from time import sleep
from datetime import datetime
from .settings import DEBUG
from .utils.database import get_myaas_containers, get_enabled_backend
from .utils.container import client

        self.__killed = True


class ContainerFilter(object):
    def __init__(self, expired=False, dead=False, unhealthy=False):
        self._expired = expired
        self._dead = dead
        self._unhealthy = unhealthy

    def filter(self, containers):
        if self._expired:
            logger.info('* Filtering expired')
        if self._dead:
            logger.info('* Filtering exited')
        if self._unhealthy:
            logger.info('* Filtering unhealthy')
        return filter(self._is_removable, containers)

    def _is_removable(self, container):
        name = get_container_name(container)
        if self._expired and self._is_expired(container):
            logger.info("%s is expired, queued for deletion", name)
            return True

        if self._dead and self._is_dead(container):
            logger.info("%s is dead, queued for deletion", name)
            return True

        if self._unhealthy and self._is_unhealthy(container):
            logger.info("%s is unhealthy, queued for deletion", name)

            return True