Ejemplo n.º 1
0
def log_network_info_all_nodes(event_loop):
    _begin = time.time()
    info('\nget network info from all nodes\n')
    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.log_network_info_one_node_async(node, event_loop)
            for node in ALL_NODES
        ]))
Ejemplo n.º 2
0
def main() -> None:
    # Replace with the executable you want to test
    try:
        info("Run someprojectbinary...")
        run_project_executable("someprojectbinary")
        info("OK")
    except OSError as e:
        warn(f"Failed to run command: {e}")
        sys.exit(1)
Ejemplo n.º 3
0
def open_all_tunnels(event_loop):
    _begin = time.time()
    info('\nStarting all SSH tunnels\n')
    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.open_one_tunnel_async(node, 9000 + pos, event_loop)
            for pos, node in enumerate(ALL_NODES)
        ]))
    warn('\nAll SSH tunnels opened in %5.3f seconds\n' %
         (time.time() - _begin))
Ejemplo n.º 4
0
def collect_coverage_all_nodes(event_loop, verbose=False):
    _begin = time.time()
    if verbose:
        info('\nCollecting coverage from all nodes')
    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.collect_coverage_one_node_async(
                node, event_loop=event_loop, verbose=verbose)
            for node in ALL_NODES
        ]))
    if verbose:
        warn('\n\nAll coverage files received in  %5.3f seconds\n' %
             (time.time() - _begin))
Ejemplo n.º 5
0
def clean_all_nodes(event_loop, skip_checks=False, verbose=False):
    _begin = time.time()
    info('\nCleaning all nodes')
    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.clean_one_node_async(
                node, event_loop=event_loop, verbose=verbose)
            for node in ALL_NODES
        ]))
    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.clean_one_customer_async(
                node['name'], event_loop=event_loop, verbose=verbose)
            for node in ALL_ROLES['customer']
        ]))
    warn('\n\nAll nodes cleaned in %5.3f seconds\n' % (time.time() - _begin))
Ejemplo n.º 6
0
def start_all_nodes(event_loop, verbose=False):
    _begin = time.time()
    if verbose:
        warn('\nStarting BitDust nodes\n')

    for number, dhtseed in enumerate(ALL_ROLES.get('dht-seed', [])):
        # first seed to be started immediately, all other seeds must wait a bit before start
        tsup.start_one_dht_seed(dhtseed,
                                wait_seconds=(3 if number > 0 else 0),
                                verbose=verbose)
    if verbose:
        info('ALL DHT SEEDS STARTED\n')

    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.start_one_identity_server_async(idsrv, event_loop)
            for idsrv in ALL_ROLES.get('identity-server', [])
        ]))
    if verbose:
        info(f'ALL ID SERVERS STARTED\n')

    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.start_one_stun_server_async(stunsrv, event_loop)
            for stunsrv in ALL_ROLES.get('stun-server', [])
        ]))
    if verbose:
        info(f'ALL STUN SERVERS STARTED\n')

    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.start_one_proxy_server_async(proxy_server, event_loop)
            for proxy_server in ALL_ROLES.get('proxy-server', [])
        ]))
    if verbose:
        info(f'ALL PROXY SERVERS STARTED\n')

    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.start_one_supplier_async(supplier, event_loop)
            for supplier in ALL_ROLES.get('supplier', [])
        ]))
    if verbose:
        info(f'ALL SUPPLIERS STARTED\n')

    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.start_one_message_broker_async(message_broker, event_loop)
            for message_broker in ALL_ROLES.get('message-broker', [])
        ]))
    if verbose:
        info(f'ALL MESSAGE BROKERS STARTED\n')

    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.start_one_customer_async(
                customer, event_loop, sleep_before_start=i * 3)
            for i, customer in enumerate(ALL_ROLES.get('customer', []))
        ]))
    if verbose:
        info(f'ALL CUSTOMERS STARTED\n')

    warn('ALL NODES STARTED in %5.3f seconds\n' % (time.time() - _begin))
Ejemplo n.º 7
0
def kill_all_nodes():
    for node in ALL_NODES:
        info('Shutdown %s' % node)
        tsup.run_ssh_command_and_wait(node, 'pkill -e sshd')
    warn('All nodes stopped')
Ejemplo n.º 8
0
def stop_all_nodes(event_loop, verbose=False):
    _begin = time.time()
    if verbose:
        warn('\nstop all nodes\n')

    if verbose:
        info('customers: %r' % ALL_ROLES.get('customer', []))
    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.stop_daemon_async(customer['name'],
                                   event_loop,
                                   skip_checks=True,
                                   verbose=verbose)
            for customer in ALL_ROLES.get('customer', [])
        ]))
    if verbose:
        info(f'ALL CUSTOMERS STOPPED\n')

    if verbose:
        info('message-brokers: %r' % ALL_ROLES.get('message-broker', []))
    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.stop_daemon_async(
                message_broker['name'], event_loop, verbose=verbose)
            for message_broker in ALL_ROLES.get('message-broker', [])
        ]))
    if verbose:
        info(f'ALL MESSAGE BROKERS STOPPED\n')

    if verbose:
        info('suppliers: %r' % ALL_ROLES.get('supplier', []))
    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.stop_daemon_async(
                supplier['name'], event_loop, verbose=verbose)
            for supplier in ALL_ROLES.get('supplier', [])
        ]))
    if verbose:
        info(f'ALL SUPPLIERS STOPPED\n')

    if verbose:
        info('proxy-servers: %r' % ALL_ROLES.get('proxy-server', []))
    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.stop_daemon_async(
                proxy_server['name'], event_loop, verbose=verbose)
            for proxy_server in ALL_ROLES.get('proxy-server', [])
        ]))
    if verbose:
        info(f'ALL PROXY SERVERS STOPPED\n')

    if verbose:
        info('stun-servers: %r' % ALL_ROLES.get('stun-server', []))
    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.stop_daemon_async(
                stunsrv['name'], event_loop, verbose=verbose)
            for stunsrv in ALL_ROLES.get('stun-server', [])
        ]))
    if verbose:
        info(f'ALL STUN SERVERS STOPPED\n')

    if verbose:
        info('identity-servers: %r' % ALL_ROLES.get('identity-server', []))
    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.stop_daemon_async(idsrv['name'], event_loop, verbose=verbose)
            for idsrv in ALL_ROLES.get('identity-server', [])
        ]))
    if verbose:
        info(f'ALL ID SERVERS STOPPED\n')

    if verbose:
        info('dht-seeds: %r' % ALL_ROLES.get('dht-seed', []))
    event_loop.run_until_complete(
        asyncio.gather(*[
            tsup.stop_daemon_async(
                dhtseed['name'], event_loop, verbose=verbose)
            for dhtseed in ALL_ROLES.get('dht-seed', [])
        ]))
    if verbose:
        info('ALL DHT SEEDS STOPPED\n')

    warn('\nALL NODES STOPPED in %5.3f seconds\n' % (time.time() - _begin))