fix db time

This commit is contained in:
yangdsh 2020-04-27 19:14:25 +00:00 committed by Dana Van Aken
parent 3f0c82abbd
commit 3584dff8d8
3 changed files with 6 additions and 4 deletions

View File

@ -189,6 +189,7 @@ class BaseParser:
def convert_dbms_metrics(self, metrics, observation_time, target_objective):
metric_data = {}
# Same as metric_data except COUNTER metrics are not divided by the time
# Note: metric_data is also not divided by the time now so base_metric_data is redundant
base_metric_data = {}
numeric_metric_catalog = MetricCatalog.objects.filter(
dbms__id=self.dbms_id, metric_type__in=MetricType.numeric())
@ -227,7 +228,7 @@ class BaseParser:
for target_name, target_instance in target_list.items():
metric_data[target_name] = target_instance.compute(
metrics, observation_time)
base_metric_data, observation_time)
return metric_data

View File

@ -131,7 +131,7 @@ class TargetObjectives:
if not self.registered():
self.register()
dbms_id = int(dbms_id)
instance = self._registry[dbms_id][target_objective]
instance = self._registry[dbms_id].get(target_objective, 'None')
return instance
def get_all(self, dbms_id=None):

View File

@ -655,13 +655,14 @@ def handle_result_files(session, files, execution_times=None):
# The metric should not be used for learning because the knob value is not real
metric_data.name = 'default_' + metric_data.name
metric_data.save()
# Load the values in the default result into the metric_catalog
for name in numeric_metric_dict.keys():
if 'time_waited_micro_fg' in name or 'total_waits_fg' in name:
metric = MetricCatalog.objects.get(dbms=dbms, name=name)
metric.default = numeric_metric_dict[name]
metric.save()
all_target_objectives = target_objectives.get_all(session.dbms.pk)
normalized_db_time = all_target_objectives.get('db_time', None)
# Replace the default values in 'db_time' with the new values in the metric_catalog
normalized_db_time = target_objectives.get_instance(session.dbms.pk, 'db_time')
if normalized_db_time is not None:
normalized_db_time.reload_default_metrics()
numeric_metric_dict = parser.convert_dbms_metrics(