Esempio n. 1
0
def present_token_and_token_after_termination(configurations, algorithm):
    data = []

    for fault_group, configurations_sorted in configurations.items():
        for i, c in enumerate(configurations_sorted):
            data.append(
                graphing.get_box_trace(
                    c.get_tokens(),
                    'T %s %i' % (fault_group, c.number_of_nodes)))
            data.append(
                graphing.get_box_trace(
                    c.get_tokens_after_termination(),
                    'T %s %i' % (fault_group, c.number_of_nodes),
                    'rgb(255,140,0)'))
            if fault_group == '90':
                data.append(
                    graphing.get_box_trace(
                        c.get_backup_tokens(),
                        'T %s %i' % (fault_group, c.number_of_nodes),
                        'rgb(140,255,0)'))

    plotly.offline.plot(
        graphing.hide_layout(data),
        filename='../graphs/tokens_and_tokens_after_faulty-%s.html' %
        algorithm)
def present_token_and_token_after_termination(configurations):
  data = []

  network_sizes = 4
  for i in range(network_sizes):
    fs_configuration = configurations['0 fs'][i]
    ft_configuration = configurations['0'][i]
    data.append(graphing.get_box_trace(fs_configuration.get_tokens(), 'FS %i' % fs_configuration.number_of_nodes))
    data.append(graphing.get_box_trace(fs_configuration.get_tokens_after_termination(),
                                       'FS %i' % fs_configuration.number_of_nodes, 'rgb(255,140,0)'))

    data.append(graphing.get_box_trace(ft_configuration.get_tokens(), 'FT %i' % ft_configuration.number_of_nodes))
    data.append(graphing.get_box_trace(ft_configuration.get_tokens_after_termination(),
                                       'FT %i' % ft_configuration.number_of_nodes, 'rgb(255,140,0'))

  plotly.offline.plot(graphing.hide_layout(data), filename='../graphs/tokens_and_token_after_termination_box_plot.html')
Esempio n. 3
0
def present_total_times(configurations, algorithm):
    data = []

    for fault_group, configurations_sorted in configurations.items():
        for i, c in enumerate(configurations_sorted):
            data.append(
                graphing.get_box_trace(
                    c.get_average_total_times(),
                    'T %s %i' % (fault_group, c.number_of_nodes)))
            data.append(
                graphing.get_box_trace(
                    c.get_total_times_after_termination(),
                    'T %s %i' % (fault_group, c.number_of_nodes),
                    'rgb(255,140,0)'))

    plotly.offline.plot(data,
                        filename='../graphs/total_times-%s.html' % algorithm)
print("Estimated ratio of repetition with early official termination: %f" % (
      repetitions_with_rea_warnings / repetitions_with_crashes))

pprint(expected_configurations, indent=2)

compare_safra_versions(configurations, algorithm)
analyse_influence_of_network_size(configurations)
analyse_influence_of_faults(configurations, algorithm)

fields = ['tokens', 'tokens_after_termination', 'number_of_nodes_crashed', 'safra_times', 'basic_times',
          'safra_times_after_termination', 'total_times', 'token_bytes', 'backup_tokens']
data = defaultdict(lambda: list())

for f in fields:
  for c in configurations:
    data[f].append(get_box_trace(getattr(c, 'get_' + f)(),
                                 "%i-%f-%r" % (c.number_of_nodes, c.fault_percentage, c.fault_sensitive)))

# for plot_name, plot_data in data.items():
#     plotly.offline.plot(plot_data, filename='../graphs/%s.html' % plot_name)

# for configuration in merged_configurations:
#     data = get_scatter_graph_with_mean_and_confidence_interval(list(range(len(configuration.repetitions))), configuration.get_tokens(), "tokens")


# data += get_scatter_graph_with_mean_and_confidence_interval(list(range(len(configuration.repetitions))), configuration.get_number_of_nodes_crashed(), "faults")
# data += get_scatter_graph_with_mean_and_confidence_interval(list(range(len(configuration.repetitions))), configuration.get_backup_tokens(), "backup")
# data += get_scatter_graph_with_mean_and_confidence_interval(list(range(len(configuration.repetitions))), configuration.get_tokens_after_termination(), "afterTermination")
# data += get_scatter_graph_with_mean_and_confidence_interval(list(range(len(configuration.repetitions))), configuration.get_safra_time(), "times")
# plotly.offline.plot(data, filename='../graphs/graph.html')