def extract_grouped_results(db_obj, trace_id_rows_colors, edges, result_type): """Takes a list of lists of trace_is and produces a list of lists of results corresponding to them. Args: - db_obj: DBManager object connted to a db where the results will be pulled from. - trace_id_rows_colors: list of lists of integers as trace_ids of experiments. - edges: if set to [""], it does no effect, the function extracts results of the type result_type. If set to a list of items, results will be pulled for each element as: "g"+str(edge)+_str(result_type) - result_type: string indentifying which type of result are we pulling. It correspond to the type of the NumericStats stored in db_obj. Returns: a dictionary indexed by edges. Each element is a list of lists of same dimension of trace_id_rows_colors, each element a NumericStats object corresponding to the result of that component. """ exp_rows = {} for edge in edges: exp_rows[edge] = extract_results( db_obj, trace_id_rows_colors, ResultTrace.get_result_type_edge(edge, result_type)) return exp_rows exp_rows = {} for edge in edges: exp_rows[edge] = [] for row in trace_id_rows_colors: these_rows = {} for edge in edges: these_rows[edge] = [] exp_rows[edge].append(these_rows[edge]) for trace_id in row: exp = ExperimentDefinition() exp.load(db_obj, trace_id) for edge in edges: result = None if exp.is_it_ready_to_process(): if edge == "": key = ResultTrace.get_result_type_edge( edge, result_type) else: key = result_type key += "_stats" result = NumericStats() result.load(db_obj, trace_id, key) else: result = NumericStats() result.calculate([0, 0, 0]) these_rows[edge].append(result) return exp_rows
y_limits_dic = { "[0,48] core.h": (1, 1000), "(48, 960] core.h": (1, 100), "(960, inf.) core.h": (1, 20) } target_dir = "percent" grouping = [1, 3, 3, 3, 3, 3] colors, hatches, legend = produce_plot_config(db_obj, trace_id_rows) name = "Slowdown" for edge in core_seconds_edges: edge_result_type = ResultTrace.get_result_type_edge(edge, result_type) print("Loading " + edge_result_type) edge_plot_results = extract_results(db_obj, trace_id_rows, edge_result_type) edge_formated = edge_keys[edge] title = "Jobs slowdow: {0}".format(edge_formated) y_limits = y_limits_dic[edge_formated] print("Plotting figure") plot_multi_exp_boxplot( name=title, file_name=target_dir + "/percent-slow_down_jobs-{0}.png".format(file_name_edges[edge]), title=title, exp_rows=edge_plot_results, y_axis_labels=manifest_label, x_axis_labels=time_labels,