Exemple #1
0
def main(args):
    if '.' not in sys.path:
        sys.path.insert(0, '.')

    if args.config:
        with open(args.config) as fle:
            config = yaml.safe_load(fle)
    else:
        config = {AMQP_URI_CONFIG_KEY: args.broker}

    if args.logging_config_file:
        logging.config.fileConfig(args.logging_config_file,
                                  disable_existing_loggers=False)
    elif 'LOGGING' in config:
        logging.config.dictConfig(config['LOGGING'])
    else:
        logging.basicConfig(level=logging.INFO, format='%(message)s')

    services = []
    for path in args.services:
        services.extend(import_service(path))

    kwargs = {'backdoor_port': args.backdoor_port}
    if config.get(AUTORELOAD_CONFIG_KEY):
        logger.info('autoreload enabled')
        autoreload.make_autoreload(run, args=(services, config), kwargs=kwargs)
    else:
        run(services, config, **kwargs)
Exemple #2
0
def main(args):
    if '.' not in sys.path:
        sys.path.insert(0, '.')

    if args.config:
        with open(args.config) as fle:
            config = yaml.load(fle)
    else:
        config = {AMQP_URI_CONFIG_KEY: args.broker}

    if args.listen:
        config[WEB_SERVER_CONFIG_KEY] = args.listen

    if "LOGGING" in config:
        logging.config.dictConfig(config['LOGGING'])
    else:
        logging.basicConfig(level=logging.INFO, format='%(message)s')

    services = []
    for path in args.services:
        services.extend(import_service(path))

    run(services, config, backdoor_port=args.backdoor_port)
Exemple #3
0
#!/usr/bin/env python3

from nameko.cli.run import run

from AutoReef.common import rabbit_config
from AutoReef.services import LoggingService, TempMonitorService, TempProbeService

print("Start services")
services = []
services.append(LoggingService)
print("- logging")
services.append(TempMonitorService)
print("- tempmon")
services.append(TempProbeService)
print("- tempprobe")

print("running...\n")
run(services, rabbit_config)