コード例 #1
0
ファイル: cluster.py プロジェクト: zxgdhd/sawtooth-core
def do_cluster_stats(args):
    # pylint: disable=redefined-variable-type
    file_name = \
        os.path.join(os.path.expanduser("~"), '.sawtooth', 'cluster',
                     "state.yaml")
    # Get current expected state
    if os.path.isfile(file_name):
        with open(file_name, 'r') as state_file:
            state = yaml.load(state_file)
    else:
        raise CliException("Missing state file")

    node_controller = get_node_controller(state, args)

    node_command_generator = SimpleNodeCommandGenerator()

    vnm = ValidatorNetworkManager(
        node_controller=node_controller,
        node_command_generator=node_command_generator)

    nodes = state["Nodes"]
    for node_name in nodes:
        try:
            node_ip = vnm.get_ip(node_name)
            node_name_stats = node_name
            break
        except ManagementError as e:
            raise CliException(str(e))

    node_url = "http://" + node_ip.strip(' \t\n\r') + ":" + \
               nodes[node_name_stats]["HttpPort"]

    run_stats(node_url)
コード例 #2
0
ファイル: cluster.py プロジェクト: lysol/sawtooth-core
def do_cluster_stats(args):
    state = load_state()

    node_controller = get_node_controller(state, args)
    node_command_generator = SimpleNodeCommandGenerator()

    vnm = ValidatorNetworkManager(
        node_controller=node_controller,
        node_command_generator=node_command_generator)

    nodes = state["Nodes"]
    for node_name in nodes:
        try:
            node_ip = vnm.get_ip(node_name)
            node_name_stats = node_name
            break
        except ManagementError as e:
            raise CliException(str(e))

    node_url = "http://" + node_ip.strip(' \t\n\r') + ":" + \
               nodes[node_name_stats]["HttpPort"]

    run_stats(node_url)
コード例 #3
0
ファイル: cluster.py プロジェクト: jsmitchell/sawtooth-core
def do_cluster_stats(args):
    state = load_state()

    node_controller = get_node_controller(state, args)
    node_command_generator = SimpleNodeCommandGenerator()

    vnm = ValidatorNetworkManager(
        node_controller=node_controller,
        node_command_generator=node_command_generator)

    nodes = state["Nodes"]
    for node_name in nodes:
        try:
            node_ip = vnm.get_ip(node_name)
            node_name_stats = node_name
            break
        except ManagementError as e:
            raise CliException(str(e))

    node_url = "http://" + node_ip.strip(' \t\n\r') + ":" + \
               nodes[node_name_stats]["HttpPort"]

    run_stats(node_url)