Exemple #1
0
    def __init__(self, parse_conf=True):
        """Initialize a configuration from a conf directory and conf file."""
        super(TestConfigPrivate, self).__init__()
        config_files = []
        failsafe_path = self.DEFAULT_CONFIG_FILE

        # Environment variables override defaults...
        conf_dir = os.environ.get('TEST_CONFIG_DIR',
                                  self.DEFAULT_CONFIG_DIR)
        conf_file = os.environ.get('TEST_CONFIG_FILE', self.DEFAULT_CONFIG_FILE)

        path = os.path.join(conf_dir, conf_file)

        if not os.path.isfile(path):
            path = failsafe_path

        # only parse the config file if we expect one to exist. This is needed
        # to remove an issue with the config file up to date checker.
        if parse_conf:
            config_files.append(path)

        cfg.CONF([], project='contrailtest', default_config_files=config_files)
        logging.setup('contrailtest')
        LOG = logging.getLogger('contrailtest')
        LOG.info("Using contrailtest config file %s" % path)
        register_opts()
        self._set_attrs()
        if parse_conf:
            cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
Exemple #2
0
def prepare_service(argv=None):
    log_levels = (cfg.CONF.default_log_levels +
                              ['stevedore=INFO', 'keystoneclient=INFO'])
    cfg.set_defaults(log.log_opts,
                                 default_log_levels=log_levels)
    if argv is None:
        argv = sys.argv
    cfg.CONF(argv[1:], project='ceilometer', validate_default_values=True)
    log.setup('ceilometer')
Exemple #3
0
def rest():
    config.parse_args(sys.argv)
    logging.setup("cloudemulator")

    launcher = service.process_launcher()

    server = service.WSGIService('rest', use_ssl=False,
                                 max_url_len=16384)
    launcher.launch_service(server, workers=server.workers or 1)
    launcher.wait()
Exemple #4
0
def main():
    CONF.parseArgs(sys.argv[1:])
    logging.setup(name="time_lapse", level=CONF.log_level, conf_file=CONF.log_file)
    launcher = ProcessLauncher()
    # create a service class
    main_service = time_lapse_service.Service.create(True, float(10.0))
    # launch a service (first GT) which in turn will launch the periodic calls

    launcher.launch_service(main_service)
    # a green thread wait, which calls ServiceLauncher.wait and waits for exit signal
    launcher.wait()
Exemple #5
0
def main():
    CONF.parseArgs(sys.argv[1:])
    logging.setup(name="garage_eye", level=CONF.log_level, conf_file=CONF.log_file)
    launcher = ProcessLauncher()
    # create a service class
    main_service = garage_eye_service.Service.create(True, float(10.0))
    # launch a service (first GT) which in turn will launch the periodic calls
    #garage_eye_service.launch_service(main_service)
    predictor_service = Train_NN.create(True, float(5.0))

    launcher.launch_service(main_service)
    launcher.launch_service(predictor_service)

    #trainer_name = CONF.importOpt(module='garage_eye_manager', name='trainer', group='app')
    #self.trainer = self.prediction_manager.get(trainer_name[0])
    # a green thread wait, which calls ServiceLauncher.wait and waits for exit signal
    #garage_eye_service.wait()
    launcher.wait()
Exemple #6
0
#!/usr/bin/env python

'''
Created on 2013-3-4

@author: zhangbin
'''
import sys
import os
# If ../ncebs/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
                                        os.pardir,
                                        os.pardir))
if os.path.exists(os.path.join(possible_topdir, '__init__.py')):
        sys.path.insert(0, possible_topdir)


from util import config
from common import log
from common import wsgi
from api import router

if __name__ == '__main__':
    
    config.parse_command_line()
    log.setup('ncebs')
    server = wsgi.Server()
    server.start(router.API.factory('aa'), default_port=9204)
    server.wait()