Ejemplo n.º 1
0
def _start_de_server(server):
    """Start the DE server and listen forever"""
    try:
        server.get_logger().info("running _start_de_server")

        server.get_logger().debug(
            "running _start_de_server: step reaper_start")
        server.reaper_start(delay=server.global_config["dataspace"].get(
            "reaper_start_delay_seconds", 1818))

        server.get_logger().debug(
            "running _start_de_server: step start_channels")
        server.start_channels()

        server.get_logger().debug(
            "running _start_de_server: step startup_complete")
        server.startup_complete.set()

        server.get_logger().debug(
            "running _start_de_server: step serve_forever")
        server.serve_forever()

        server.get_logger().debug("done with _start_de_server")
    except Exception as __e:  # pragma: no cover
        msg = f"""Server Address: {server.global_config.get('server_address')}
              Fatal Error: {__e}"""
        print(msg, file=sys.stderr)

        with contextlib.suppress(Exception):
            server.get_logger().error(msg)

        raise __e
Ejemplo n.º 2
0
def _start_de_server(server):
    '''Start the DE server and listen forever'''
    try:
        server.reaper_start(delay=server.global_config['dataspace'].get(
            'reaper_start_delay_seconds', 1818))
        server.start_channels()
        server.startup_complete.set()
        server.serve_forever()
    except Exception as __e:  # pragma: no cover
        msg = f"""Server Address: {server.global_config.get('server_address')}
              Fatal Error: {__e}"""
        print(msg, file=sys.stderr)

        try:
            server.get_logger().error(msg)
        except Exception:  # pragma: no cover
            pass

        raise __e
Ejemplo n.º 3
0
def _start_de_server(global_config, channel_config_loader):
    '''Create and start the DE server with the passed global configuration and config manager'''
    try:
        server = _create_de_server(global_config, channel_config_loader)
        server.reaper_start(delay=global_config['dataspace'].get(
            'reaper_start_delay_seconds', 1818))
        server.start_channels()
        server.serve_forever()
    except Exception as e:  # pragma: no cover
        msg = f"""Server Address: {global_config.get('server_address')}
              Fatal Error: {e}"""
        print(msg, file=sys.stderr)

        try:
            server.get_logger().error(msg)
        except Exception:
            pass

        raise e
Ejemplo n.º 4
0
def _start_de_server(server):
    """Start the DE server and listen forever"""
    try:
        server.get_logger().info("running _start_de_server")

        server.get_logger().debug(
            "running _start_de_server: step reaper_start")
        server.reaper_start(delay=server.global_config["dataspace"].get(
            "reaper_start_delay_seconds", 1818))

        server.get_logger().debug(
            "running _start_de_server: step start_channels")
        server.start_channels()

        if not server.global_config.get("no_webserver"):
            # cherrypy for metrics
            server.get_logger().debug(
                "running _start_de_server: step start_webserver (metrics)")
            server.start_webserver()

        server.get_logger().debug(
            "running _start_de_server: step startup_complete")
        server.startup_complete.set()

        server.get_logger().debug(
            "running _start_de_server: step serve_forever")
        server.serve_forever()

        server.get_logger().debug("done with _start_de_server")
    except Exception as __e:  # pragma: no cover
        msg = f"""Server Address: {server.global_config.get('server_address')}
              Fatal Error: {__e}"""
        print(msg, file=sys.stderr)

        with contextlib.suppress(Exception):
            server.get_logger().error(msg)

        raise __e
    finally:
        r = redis.Redis.from_url(server.broker_url)
        with contextlib.suppress(Exception):
            r.flushdb()
Ejemplo n.º 5
0
def _start_de_server(global_config, channel_config_loader):
    '''Create and start the DE server with the passed global configuration and config manager'''
    server = _create_de_server(global_config, channel_config_loader)
    server.reaper_start(delay=global_config['dataspace'].get('reaper_start_delay_seconds', 1818))
    server.start_channels()
    server.serve_forever()