Esempio n. 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
Esempio n. 2
0
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
Esempio n. 3
0
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
Esempio n. 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