예제 #1
0
파일: task.py 프로젝트: 1026237416/Python
 seconds (int) - number of seconds to wait
 start_date (datetime|str) - starting point for the interval calculation
 end_date (datetime|str) - latest possible date/time to trigger on
 timezone (datetime.tzinfo|str) - time zone to use for the date/time calculations

"""

CONF = config.CONF
LOG = logging.getLogger("system")

try:
    executors = {
        'default': ThreadPoolExecutor(10),
        'processpool': ProcessPoolExecutor(5),
    }
    log.init(ECLOUD_TASK_LOG_CONF)
    sched = TornadoScheduler(logger=LOG, executors=executors)
    print "Scheduler start"

    @sched.scheduled_job("interval", minutes=30)
    @gen.coroutine
    def task_db_clean():
        yield db_clean()

    @sched.scheduled_job("cron", hour=1, minute=10)
    @gen.coroutine
    def task_del_files():
        yield del_files()

    @sched.scheduled_job("interval", minutes=10)
    @gen.coroutine
예제 #2
0
from easted.utils import loadmodules
from easted.core import dbpools
from easted.core import consumer

config.register('message.url',
                setting_type=config.TYPE_STR,
                default='amqp://*****:*****@10.10.130.56:5672/%2F',
                secret=True)

CONF = config.CONF
os.chdir(sys.path[0])
LOG = logging.getLogger("system")
__author__ = '*****@*****.**'

try:
    log.init(ECLOUD_MESSAGE_LOG_CONF)
    print "Start the eworker service..."
    channels = [
        {
            "exchange_declare": None,
            "queue_declare": {
                "name": "ecloud-openstack",
                "bind": {
                    "nova": "notifications.info",
                    "cinder": "notifications.info",
                    # "keystone": "notifications.info",
                    # "neutron": "notifications.info",
                }
            },
            "adapter_declare": "easted.queue.osadapter"
        },
예제 #3
0
            if not setting[name].get('opt').secret \
                    and not setting[name].get('opt').required:
                parser.set(group, name, value)
                with open(config_file[0], mode="w") as fp:
                    parser.write(fp)
                CONF.reload_config_files()


def __extract_group_name(name_with_group):
    """extract group name
    :param name_with_group:
    :return:
    """
    if name_with_group.find(".") != -1:
        opt = name_with_group.split(".")
        group = opt[0]
        name = ".".join(opt[1:])
    else:
        group = None
        name = name_with_group
    return group, name


if __name__ == '__main__':
    from easted import log

    log.init()
    register("database.db_nova")
    print json.dumps(list_settings())
    print TYPE_INT, TYPE_BOOL, TYPE_STR, TYPE_FLOAT, str(TYPE_LIST)
예제 #4
0
config.register("cert_dir", "../etc")
config.register("port", "8443")
config.register(name="multiprocess",
                setting_type=config.TYPE_INT,
                default=None,
                secret=True)
config.register(name="debug",
                setting_type=config.TYPE_BOOL,
                default=True,
                secret=True)

CONF = config.CONF
os.chdir(sys.path[0])
LOG = logging.getLogger("system")
try:
    log.init(ECLOUD_SERVER_LOG_CONF)
    manor_launch.init()

    print "Start the easted service..."

    service_modules = [
        r for r in map(lambda x: x.split('.')[0], os.listdir('./easted/ws'))
        if r != '__init__'
    ]
    service_modules = list(set(service_modules))

    modules = []
    for m in service_modules:
        modules.append(importlib.import_module('easted.ws.' + m).Service)

    modules = manor_launch.add_handler(modules)