예제 #1
0
def start_server(servermodule, configParams, configuration, features):
    server = servermodule.BitBakeServer()
    if configParams.bind:
        (host, port) = configParams.bind.split(':')
        server.initServer((host, int(port)))
        configuration.interface = [
            server.serverImpl.host, server.serverImpl.port
        ]
    else:
        server.initServer()
        configuration.interface = []

    try:
        configuration.setServerRegIdleCallback(server.getServerIdleCB())

        cooker = bb.cooker.BBCooker(configuration, features)

        server.addcooker(cooker)
        server.saveConnectionDetails()
    except Exception as e:
        exc_info = sys.exc_info()
        while hasattr(server, "event_queue"):
            try:
                import queue
            except ImportError:
                import Queue as queue
            try:
                event = server.event_queue.get(block=False)
            except (queue.Empty, IOError):
                break
            if isinstance(event, logging.LogRecord):
                logger.handle(event)
        raise exc_info[1], None, exc_info[2]
    server.detach()
    return server
예제 #2
0
파일: main.py 프로젝트: linearlog1/poky
def start_server(servermodule, configParams, configuration, features):
    server = servermodule.BitBakeServer()
    single_use = not configParams.server_only and os.getenv('BBSERVER') != 'autostart'
    if configParams.bind:
        (host, port) = configParams.bind.split(':')
        server.initServer((host, int(port)), single_use=single_use,
                          idle_timeout=configParams.idle_timeout)
        configuration.interface = [server.serverImpl.host, server.serverImpl.port]
    else:
        server.initServer(single_use=single_use)
        configuration.interface = []

    try:
        configuration.setServerRegIdleCallback(server.getServerIdleCB())

        cooker = bb.cooker.BBCooker(configuration, features)

        server.addcooker(cooker)
        server.saveConnectionDetails()
    except Exception as e:
        while hasattr(server, "event_queue"):
            import queue
            try:
                event = server.event_queue.get(block=False)
            except (queue.Empty, IOError):
                break
            if isinstance(event, logging.LogRecord):
                logger.handle(event)
        raise
    if not configParams.foreground:
        server.detach()
    cooker.lock.close()
    return server
예제 #3
0
파일: main.py 프로젝트: neofang7/ostro-os
def start_server(servermodule, configParams, configuration, features):
    server = servermodule.BitBakeServer()
    single_use = not configParams.server_only
    if configParams.bind:
        (host, port) = configParams.bind.split(':')
        server.initServer((host, int(port)), single_use)
        configuration.interface = [server.serverImpl.host, server.serverImpl.port]
    else:
        server.initServer(single_use=single_use)
        configuration.interface = []

    try:
        configuration.setServerRegIdleCallback(server.getServerIdleCB())

        cooker = bb.cooker.BBCooker(configuration, features)

        server.addcooker(cooker)
        server.saveConnectionDetails()
    except Exception as e:
        while hasattr(server, "event_queue"):
            import queue
            try:
                event = server.event_queue.get(block=False)
            except (queue.Empty, IOError):
                break
            if isinstance(event, logging.LogRecord):
                logger.handle(event)
        raise
    server.detach()
    cooker.lock.close()
    return server
예제 #4
0
def start_server(servermodule, configParams, configuration, features):
    server = servermodule.BitBakeServer()
    if configParams.bind:
        (host, port) = configParams.bind.split(':')
        server.initServer((host, int(port)))
        configuration.interface = [ server.serverImpl.host, server.serverImpl.port ]
    else:
        server.initServer()
        configuration.interface = []

    try:
        configuration.setServerRegIdleCallback(server.getServerIdleCB())

        cooker = bb.cooker.BBCooker(configuration, features)

        server.addcooker(cooker)
        server.saveConnectionDetails()
    except Exception as e:
        exc_info = sys.exc_info()
        while hasattr(server, "event_queue"):
            try:
                import queue
            except ImportError:
                import Queue as queue
            try:
                event = server.event_queue.get(block=False)
            except (queue.Empty, IOError):
                break
            if isinstance(event, logging.LogRecord):
                logger.handle(event)
        raise exc_info[1], None, exc_info[2]
    server.detach()
    return server