if "config_recommend" in target_data:
assert "newest_result_id" in target_data and "status" in target_data
LOG.debug("%s: Skipping aggregate_target_results.\nData:\n%s\n\n",
AlgorithmType.name(algorithm), target_data)
return target_data, algorithm
newest_result = Result.objects.get(pk=result_id)
After Change
result_id, algorithm, target_data = aggregate_target_results_input
newest_result = Result.objects.get(pk=result_id)
session = newest_result.session
task_name = _get_task_name(session, result_id)
// If the preprocessing method has already generated a config, bypass this method.
if "config_recommend" in target_data:
assert "newest_result_id" in target_data and "status" in target_data
LOG.debug("\n%s: Result = %s\n", task_name, _task_result_tostring(target_data))
LOG.info("%s: Skipping aggregate_target_results (status=%s).", task_name,
target_data.get("status", ""))
return target_data, algorithm
LOG.info("%s: Aggregating target results...", task_name)
// Aggregate all knob config results tried by the target so far in this
// tuning session and this tuning workload.
target_results = Result.objects.filter(session=session,
dbms=newest_result.dbms,
workload=newest_result.workload)
LOG.debug("%s: // results: %s", task_name, len(target_results))
if len(target_results) == 0:
raise Exception("Cannot find any results for session_id={}, dbms_id={}"
.format(session, newest_result.dbms))
agg_data = DataUtil.aggregate_data(target_results)
LOG.debug("%s ~ INITIAL: X_matrix=%s, X_columnlabels=%s", task_name,
agg_data["X_matrix"].shape, len(agg_data["X_columnlabels"]))
agg_data["newest_result_id"] = result_id
agg_data["status"] = "good"
// Clean knob data
cleaned_agg_data = clean_knob_data(agg_data["X_matrix"], agg_data["X_columnlabels"], session)
agg_data["X_matrix"] = np.array(cleaned_agg_data[0])
agg_data["X_columnlabels"] = np.array(cleaned_agg_data[1])
LOG.debug("%s ~ FINAL: X_matrix=%s, X_columnlabels=%s", task_name,
agg_data["X_matrix"].shape, len(agg_data["X_columnlabels"]))
exec_time = save_execution_time(start_ts, "aggregate_target_results", newest_result)
LOG.debug("\n%s: Result = %s\n", task_name, _task_result_tostring(agg_data))
LOG.info("%s: Finished aggregating target results (%.1f seconds).", task_name, exec_time)