fix bugs
This commit is contained in:
parent
99a9c3318e
commit
13735c9b0b
|
@ -530,17 +530,17 @@ def loop(i):
|
||||||
|
|
||||||
# remove oltpbench log and controller log
|
# remove oltpbench log and controller log
|
||||||
clean_logs()
|
clean_logs()
|
||||||
|
|
||||||
# restart database
|
# restart database
|
||||||
restart_succeeded = restart_database()
|
restart_succeeded = restart_database()
|
||||||
if not restart_succeeded:
|
if not restart_succeeded:
|
||||||
files = {'summary':b'{error:"DB_RESTART_ERROR"}',
|
files = {'summary': b'{"error": "DB_RESTART_ERROR"}',
|
||||||
'knobs':b'',
|
'knobs': b'{}',
|
||||||
'metrics_before':b'',
|
'metrics_before': b'{}',
|
||||||
'metrics_after':b''}
|
'metrics_after': b'{}'}
|
||||||
response = requests.post(dconf.WEBSITE_URL + '/new_result/', files=files,
|
response = requests.post(dconf.WEBSITE_URL + '/new_result/', files=files,
|
||||||
data={'upload_code': dconf.UPLOAD_CODE})
|
data={'upload_code': dconf.UPLOAD_CODE})
|
||||||
response = get_result()
|
response = get_result()
|
||||||
|
result_timestamp = int(time.time())
|
||||||
save_next_config(response, t=result_timestamp)
|
save_next_config(response, t=result_timestamp)
|
||||||
change_conf(response['recommendation'])
|
change_conf(response['recommendation'])
|
||||||
return
|
return
|
||||||
|
|
|
@ -469,26 +469,48 @@ def handle_result_files(session, files):
|
||||||
worst_throughput = throughput
|
worst_throughput = throughput
|
||||||
LOG.debug("Worst throughput so far is:%d",worst_throughput)
|
LOG.debug("Worst throughput so far is:%d",worst_throughput)
|
||||||
|
|
||||||
# Copy latest data and modify
|
result = Result.objects.filter(session=session).order_by("-id").first()
|
||||||
knob_data = KnobData.objects.filter(session=session).order_by("-id").first()
|
backup_data = BackupData.objects.filter(result=result).first()
|
||||||
knob_data.pk = None
|
last_conf = JSONUtil.loads(result.next_configuration)
|
||||||
knob_data.save()
|
last_conf = last_conf["recommendation"]
|
||||||
|
|
||||||
metric_data = MetricData.objects.filter(session=session).order_by("-id").first()
|
# Copy latest data and modify
|
||||||
|
knob_data = result.knob_data
|
||||||
|
knob_data.pk = None
|
||||||
|
all_knobs = JSONUtil.loads(knob_data.knobs)
|
||||||
|
for knob in all_knobs.keys():
|
||||||
|
for tunable_knob in last_conf.keys():
|
||||||
|
if tunable_knob in knob:
|
||||||
|
print(tunable_knob, knob)
|
||||||
|
all_knobs[knob] = last_conf[tunable_knob]
|
||||||
|
knob_data.knobs = JSONUtil.dumps(all_knobs)
|
||||||
|
|
||||||
|
data_knobs = JSONUtil.loads(knob_data.data)
|
||||||
|
for knob in data_knobs.keys():
|
||||||
|
for tunable_knob in last_conf.keys():
|
||||||
|
if tunable_knob in knob:
|
||||||
|
data_knobs[knob] = last_conf[tunable_knob]
|
||||||
|
knob_data.data = JSONUtil.dumps(data_knobs)
|
||||||
|
knob_data.name = knob_data.name + '*'
|
||||||
|
knob_data.save()
|
||||||
|
knob_data = KnobData.objects.filter(session=session).order_by("-id").first()
|
||||||
|
|
||||||
|
metric_data = result.metric_data
|
||||||
metric_cpy = JSONUtil.loads(metric_data.data)
|
metric_cpy = JSONUtil.loads(metric_data.data)
|
||||||
metric_cpy["throughput_txn_per_sec"]=worst_throughput
|
metric_cpy["throughput_txn_per_sec"]=worst_throughput
|
||||||
metric_cpy = JSONUtil.dumps(metric_cpy)
|
metric_cpy = JSONUtil.dumps(metric_cpy)
|
||||||
metric_data.pk = None
|
metric_data.pk = None
|
||||||
|
metric_data.name = metric_data.name + '*'
|
||||||
metric_data.data = metric_cpy
|
metric_data.data = metric_cpy
|
||||||
metric_data.save()
|
metric_data.save()
|
||||||
|
metric_data = MetricData.objects.filter(session=session).order_by("-id").first()
|
||||||
|
|
||||||
result = Result.objects.filter(session=session).order_by("-id").first()
|
|
||||||
result.pk = None
|
result.pk = None
|
||||||
result.knob_data = knob_data
|
result.knob_data = knob_data
|
||||||
result.metric_data = metric_data
|
result.metric_data = metric_data
|
||||||
result.save()
|
result.save()
|
||||||
|
result = Result.objects.filter(session=session).order_by("-id").first()
|
||||||
|
|
||||||
backup_data = BackupData.objects.filter(result=result).first()
|
|
||||||
backup_data.pk = None
|
backup_data.pk = None
|
||||||
backup_data.result = result
|
backup_data.result = result
|
||||||
backup_data.save()
|
backup_data.save()
|
||||||
|
|
Loading…
Reference in New Issue