# Path: src/myaas/settings.py
# HOSTNAME = config('MYAAS_HOSTNAME', default='localhost')
# 
# DEBUG = config('MYAAS_DEBUG', default=False, cast=bool)
# 
# CONTAINER_TTL = config('MYAAS_CONTAINER_TTL', cast=int, default=86400)
# 
# 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/utils/database.py
# def get_myaas_containers():
#     return filter(_is_database_container, list_containers())
# 
# def get_enabled_backend():
#     return importlib.import_module(settings.BACKEND)
# 
# def list_databases():
#     containers = filter(_is_database_container, list_containers())
#     return [_get_database_name(c) for c in containers]
# 
# def list_database_templates():
#     containers = filter(_is_template_container, list_containers())
#     return [_get_database_name(c) for c in containers]
# 
# Path: src/myaas/backends/exceptions.py
# class NonExistentDatabase(Exception):
#     pass
# 
# class NonExistentTemplate(NonExistentDatabase):
#     pass
# 
# class ImportInProgress(Exception):
#     pass


import logging
import os
from flask import Flask, Response, request, jsonify, abort
from .settings import HOSTNAME, DEBUG, CONTAINER_TTL
from .utils.container import client
from .utils.database import (get_myaas_containers, get_enabled_backend,
                             list_databases, list_database_templates)
from .backends.exceptions import (NonExistentDatabase, NonExistentTemplate,
                                  ImportInProgress)



app = Flask(__name__)

logger = logging
logger.basicConfig(
    format='%(asctime)s {:4} %(levelname)s: %(message)s'.format(os.getpid()),

# Path: src/myaas/settings.py
# HOSTNAME = config('MYAAS_HOSTNAME', default='localhost')
# 
# DEBUG = config('MYAAS_DEBUG', default=False, cast=bool)
# 
# CONTAINER_TTL = config('MYAAS_CONTAINER_TTL', cast=int, default=86400)
# 
# 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/utils/database.py
# def get_myaas_containers():
#     return filter(_is_database_container, list_containers())
# 
# def get_enabled_backend():
#     return importlib.import_module(settings.BACKEND)
# 
# def list_databases():
#     containers = filter(_is_database_container, list_containers())
#     return [_get_database_name(c) for c in containers]
# 
# def list_database_templates():
#     containers = filter(_is_template_container, list_containers())
#     return [_get_database_name(c) for c in containers]
# 
# Path: src/myaas/backends/exceptions.py
# class NonExistentDatabase(Exception):
#     pass
# 
# class NonExistentTemplate(NonExistentDatabase):
#     pass
# 
# class ImportInProgress(Exception):
#     pass


# Path: src/myaas/server.py
import logging
import os
from flask import Flask, Response, request, jsonify, abort
from .settings import HOSTNAME, DEBUG, CONTAINER_TTL
from .utils.container import client
from .utils.database import (get_myaas_containers, get_enabled_backend,
                             list_databases, list_database_templates)
from .backends.exceptions import (NonExistentDatabase, NonExistentTemplate,
                                  ImportInProgress)




app = Flask(__name__)

logger = logging
logger.basicConfig(
    format='%(asctime)s {:4} %(levelname)s: %(message)s'.format(os.getpid()),

    level=logging.DEBUG if DEBUG else logging.WARNING)