def testValidImportantKnobs(self): workloads = Workload.objects.all() wkld_results = Result.objects.filter(workload=workloads[0]) knob_data, metric_data = aggregate_data(wkld_results) # instead of doing actual metric pruning by factor analysis / clustering, # just randomly select 5 nonconstant metrics nonconst_metric_columnlabels = [] for col, cl in zip(metric_data['data'].T, metric_data['columnlabels']): if np.any(col != col[0]): nonconst_metric_columnlabels.append(cl) num_metrics = min(5, len(nonconst_metric_columnlabels)) selected_columnlabels = np.random.choice(nonconst_metric_columnlabels, num_metrics, replace=False) pruned_metric_idxs = [ i for i, metric_name in enumerate(metric_data['columnlabels']) if metric_name in selected_columnlabels ] pruned_metric_data = { 'data': metric_data['data'][:, pruned_metric_idxs], 'rowlabels': copy.deepcopy(metric_data['rowlabels']), 'columnlabels': [metric_data['columnlabels'][i] for i in pruned_metric_idxs] } # run knob_identification using knob_data and fake pruned metrics ranked_knobs = run_knob_identification(knob_data, pruned_metric_data, workloads[0].dbms) for k in ranked_knobs: self.assertIn(k, knob_data['columnlabels'])
def testValidPrunedMetrics(self): workloads = Workload.objects.all() wkld_results = Result.objects.filter(workload=workloads[0]) metric_data = aggregate_data(wkld_results)[1] pruned_metrics = run_workload_characterization(metric_data) for m in pruned_metrics: self.assertIn(m, metric_data['columnlabels'])
def testValidWorkload(self): workloads = Workload.objects.all() valid_workload = workloads[0] dicts = aggregate_data(valid_workload) keys = ['data', 'rowlabels', 'columnlabels'] for d in dicts: for k in keys: self.assertIn(k, d)
def testValidWorkload(self): workloads = Workload.objects.all() valid_workload = workloads[0] wkld_results = Result.objects.filter(workload=valid_workload) dicts = aggregate_data(wkld_results) keys = ['data', 'rowlabels', 'columnlabels'] for d in dicts: for k in keys: self.assertIn(k, d)