support user defined metrics

This commit is contained in:
bohanjason 2020-04-28 00:21:04 -04:00 committed by Dana Van Aken
parent 346a2470b5
commit 6c436e66c0
3 changed files with 12 additions and 4 deletions

View File

@ -93,7 +93,7 @@ DRIVER_HOME = os.path.dirname(os.path.realpath(__file__))
RESULT_DIR = os.path.join(DRIVER_HOME, 'results') RESULT_DIR = os.path.join(DRIVER_HOME, 'results')
# Set this to add user defined metrics # Set this to add user defined metrics
ENABLE_UDM = True ENABLE_UDM = False
# Path to the User Defined Metrics (UDM), only required when ENABLE_UDM is True # Path to the User Defined Metrics (UDM), only required when ENABLE_UDM is True
UDM_DIR = os.path.join(DRIVER_HOME, 'userDefinedMetrics') UDM_DIR = os.path.join(DRIVER_HOME, 'userDefinedMetrics')

View File

@ -599,6 +599,12 @@ def clean_logs():
local('rm -f {} {}'.format(dconf.OLTPBENCH_LOG, dconf.CONTROLLER_LOG)) local('rm -f {} {}'.format(dconf.OLTPBENCH_LOG, dconf.CONTROLLER_LOG))
@task
def clean_oltpbench_results():
# remove oltpbench result files
local('rm -f {}/results/*'.format(dconf.OLTPBENCH_HOME))
@task @task
def loop(i): def loop(i):
i = int(i) i = int(i)
@ -642,6 +648,7 @@ def loop(i):
# add user defined metrics # add user defined metrics
if dconf.ENABLE_UDM is True: if dconf.ENABLE_UDM is True:
add_udm() add_udm()
clean_oltpbench_results()
# save result # save result
result_timestamp = save_dbms_result() result_timestamp = save_dbms_result()
@ -687,7 +694,6 @@ def run_loops(max_iter=10):
# reload database periodically # reload database periodically
if dconf.RELOAD_INTERVAL > 0: if dconf.RELOAD_INTERVAL > 0:
# wait 5 secs after restarting databases
time.sleep(15) time.sleep(15)
if i % dconf.RELOAD_INTERVAL == 0: if i % dconf.RELOAD_INTERVAL == 0:
if i == 0 and dump is False: if i == 0 and dump is False:

View File

@ -4,8 +4,9 @@ import copy
import argparse import argparse
import os import os
sys.path.append("../../../") sys.path.append("../../../")
sys.path.append("../")
from server.website.website.types import VarType # pylint: disable=import-error,wrong-import-position,line-too-long # noqa: E402 from server.website.website.types import VarType # pylint: disable=import-error,wrong-import-position,line-too-long # noqa: E402
from driver_config import OLTPBENCH_HOME # pylint: disable=import-error,wrong-import-position # noqa: E402
parser = argparse.ArgumentParser() # pylint: disable=invalid-name parser = argparse.ArgumentParser() # pylint: disable=invalid-name
parser.add_argument("result_dir") parser.add_argument("result_dir")
@ -37,7 +38,8 @@ USER_DEINFED_METRICS = {
def get_udm(): def get_udm():
with open('../oltpbench.summary', 'r') as f: summary_path = OLTPBENCH_HOME + '/results/outputfile.summary'
with open(summary_path, 'r') as f:
info = json.load(f) info = json.load(f)
metrics = copy.deepcopy(USER_DEINFED_METRICS) metrics = copy.deepcopy(USER_DEINFED_METRICS)
if HAS_TARGET_OBJECTIVE is False: if HAS_TARGET_OBJECTIVE is False: