Beispiel #1
0
def test_process_set_title():
    from uuid import uuid4
    from multiprocessing import Queue
    from setproctitle import getproctitle
    from bigchaindb.utils import Process

    queue = Queue()
    uuid = str(uuid4())

    process = Process(target=lambda: queue.put(getproctitle()), name=uuid)
    process.start()
    assert queue.get() == uuid
Beispiel #2
0
def test_process_set_title():
    from uuid import uuid4
    from multiprocessing import Queue
    from setproctitle import getproctitle
    from bigchaindb.utils import Process

    queue = Queue()
    uuid = str(uuid4())

    process = Process(target=lambda: queue.put(getproctitle()),
                      name=uuid)
    process.start()
    assert queue.get() == uuid
Beispiel #3
0
def setup_sub_logger(*, user_log_config=None):
    kwargs = {}
    log_port = user_log_config.get(
        'port') if user_log_config is not None else None

    if log_port is not None:
        kwargs['port'] = log_port

    server = LogRecordSocketServer(**kwargs)
    with server:
        server_proc = Process(
            name='logging_server',
            target=server.serve_forever,
            kwargs={'log_config': user_log_config},
        )
        server_proc.start()
Beispiel #4
0
def abci_server():
    from abci import ABCIServer
    from bigchaindb.tendermint.core import App
    from bigchaindb.utils import Process

    app = ABCIServer(app=App())
    abci_proxy = Process(name='ABCI', target=app.run)
    yield abci_proxy.start()
    abci_proxy.terminate()
Beispiel #5
0
def abci_server():
    from abci import ABCIServer
    from bigchaindb.core import App
    from bigchaindb.utils import Process

    app = ABCIServer(app=App())
    abci_proxy = Process(name='ABCI', target=app.run)
    yield abci_proxy.start()
    abci_proxy.terminate()
Beispiel #6
0
def start():
    # Exchange object for event stream api
    logger.info('Starting BigchainDB')
    exchange = Exchange()
    # start the web api
    app_server = server.create_server(settings=bigchaindb.config['server'],
                                      log_config=bigchaindb.config['log'],
                                      bigchaindb_factory=BigchainDB)
    p_webapi = Process(name='bigchaindb_webapi',
                       target=app_server.run,
                       daemon=True)
    p_webapi.start()

    # start message
    logger.info(BANNER.format(bigchaindb.config['server']['bind']))

    # start websocket server
    p_websocket_server = Process(name='bigchaindb_ws',
                                 target=websocket_server.start,
                                 daemon=True,
                                 args=(exchange.get_subscriber_queue(
                                     EventTypes.BLOCK_VALID), ))
    p_websocket_server.start()

    # connect to tendermint event stream
    p_websocket_client = Process(name='bigchaindb_ws_to_tendermint',
                                 target=event_stream.start,
                                 daemon=True,
                                 args=(exchange.get_publisher_queue(), ))
    p_websocket_client.start()

    p_exchange = Process(name='bigchaindb_exchange',
                         target=exchange.run,
                         daemon=True)
    p_exchange.start()

    # We need to import this after spawning the web server
    # because import ABCIServer will monkeypatch all sockets
    # for gevent.
    from abci import ABCIServer

    setproctitle.setproctitle('bigchaindb')

    # Start the ABCIServer
    app = ABCIServer(app=App())
    app.run()
Beispiel #7
0
def start():
    # Exchange object for event stream api
    logger.info('Starting BigchainDB')
    exchange = Exchange()
    # start the web api
    app_server = server.create_server(
        settings=bigchaindb.config['server'],
        log_config=bigchaindb.config['log'],
        bigchaindb_factory=BigchainDB)
    p_webapi = Process(name='bigchaindb_webapi', target=app_server.run, daemon=True)
    p_webapi.start()

    # start message
    logger.info(BANNER.format(bigchaindb.config['server']['bind']))

    # start websocket server
    p_websocket_server = Process(name='bigchaindb_ws',
                                 target=websocket_server.start,
                                 daemon=True,
                                 args=(exchange.get_subscriber_queue(EventTypes.BLOCK_VALID),))
    p_websocket_server.start()

    # connect to tendermint event stream
    p_websocket_client = Process(name='bigchaindb_ws_to_tendermint',
                                 target=event_stream.start,
                                 daemon=True,
                                 args=(exchange.get_publisher_queue(),))
    p_websocket_client.start()

    p_exchange = Process(name='bigchaindb_exchange', target=exchange.run, daemon=True)
    p_exchange.start()

    # We need to import this after spawning the web server
    # because import ABCIServer will monkeypatch all sockets
    # for gevent.
    from abci import ABCIServer

    setproctitle.setproctitle('bigchaindb')

    # Start the ABCIServer
    app = ABCIServer(app=App())
    app.run()
Beispiel #8
0
def start(args):
    # Exchange object for event stream api
    logger.info('Starting BigchainDB')
    exchange = Exchange()
    # start the web api
    app_server = server.create_server(settings=bigchaindb.config['server'],
                                      log_config=bigchaindb.config['log'],
                                      bigchaindb_factory=BigchainDB)
    p_webapi = Process(name='bigchaindb_webapi',
                       target=app_server.run,
                       daemon=True)
    p_webapi.start()

    logger.info(BANNER.format(bigchaindb.config['server']['bind']))

    # start websocket server
    p_websocket_server = Process(name='bigchaindb_ws',
                                 target=websocket_server.start,
                                 daemon=True,
                                 args=(exchange.get_subscriber_queue(
                                     EventTypes.BLOCK_VALID), ))
    p_websocket_server.start()

    p_exchange = Process(name='bigchaindb_exchange',
                         target=exchange.run,
                         daemon=True)
    p_exchange.start()

    # We need to import this after spawning the web server
    # because import ABCIServer will monkeypatch all sockets
    # for gevent.
    from abci.server import ABCIServer

    setproctitle.setproctitle('bigchaindb')

    # Start the ABCIServer
    abci = ABCI(TmVersion(bigchaindb.config['tendermint']['version']))
    if args.experimental_parallel_validation:
        app = ABCIServer(app=ParallelValidationApp(
            abci=abci.types,
            events_queue=exchange.get_publisher_queue(),
        ))
    else:
        app = ABCIServer(app=App(
            abci=abci.types,
            events_queue=exchange.get_publisher_queue(),
        ))
    app.run()