def setup_server(args):

    with open(args.config, 'r') as config_stream:
        config = yaml.safe_load(config_stream)

    if not config['debug_log']:
        # NOTE(mikal): debug logging _must_ be enabled for the log writing
        # in lib.utils.execute_to_log to work correctly.
        raise Exception('Debug log not configured')

    server = worker_server.Server(config)
    server.setup_logging(config['debug_log'])

    def term_handler(signum, frame):
        server.shutdown()
    signal.signal(signal.SIGTERM, term_handler)

    if args.background:
        server.daemon = True
    server.start()

    while not server.stopped():
        try:
            time.sleep(3)
        except __HOLE__:
            print "Ctrl + C: asking tasks to exit nicely...\n"
            server.shutdown()
dataset/ETHPy150Open openstack/turbo-hipster/turbo_hipster/cmd/server.py/setup_server