fix bugs
This commit is contained in:
parent
642d7c3875
commit
7ade03e3e5
|
@ -75,7 +75,7 @@ def run(cmd, capture=True, **kwargs):
|
||||||
if cmd.endswith('&'):
|
if cmd.endswith('&'):
|
||||||
cmdd = cmd[:-1].strip()
|
cmdd = cmd[:-1].strip()
|
||||||
opts = '-d '
|
opts = '-d '
|
||||||
res = local('sudo docker exec {} -ti {} /bin/bash -c "{}"'.format(
|
res = local('docker exec {} -ti {} /bin/bash -c "{}"'.format(
|
||||||
opts, dconf.CONTAINER_NAME, cmdd), capture=capture, **kwargs)
|
opts, dconf.CONTAINER_NAME, cmdd), capture=capture, **kwargs)
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
err = str(e).strip()
|
err = str(e).strip()
|
||||||
|
@ -106,7 +106,7 @@ def sudo(cmd, user=None, capture=True, **kwargs):
|
||||||
opts = '-ti -u {}'.format(user or 'root')
|
opts = '-ti -u {}'.format(user or 'root')
|
||||||
if user == 'root':
|
if user == 'root':
|
||||||
opts += ' -w /'
|
opts += ' -w /'
|
||||||
res = local('sudo docker exec {} {} /bin/bash -c "{}"'.format(
|
res = local('docker exec {} {} /bin/bash -c "{}"'.format(
|
||||||
opts, dconf.CONTAINER_NAME, cmd), capture=capture)
|
opts, dconf.CONTAINER_NAME, cmd), capture=capture)
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
@ -123,7 +123,7 @@ def get(remote_path, local_path, use_sudo=False):
|
||||||
opts = '-r' if os.path.isdir(remote_path) else ''
|
opts = '-r' if os.path.isdir(remote_path) else ''
|
||||||
res = local('{}cp {} {} {}'.format(pre_cmd, opts, remote_path, local_path))
|
res = local('{}cp {} {} {}'.format(pre_cmd, opts, remote_path, local_path))
|
||||||
else: # docker
|
else: # docker
|
||||||
res = local('sudo docker cp {}:{} {}'.format(dconf.CONTAINER_NAME, remote_path, local_path))
|
res = local('docker cp {}:{} {}'.format(dconf.CONTAINER_NAME, remote_path, local_path))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ def put(local_path, remote_path, use_sudo=False):
|
||||||
opts = '-r' if os.path.isdir(local_path) else ''
|
opts = '-r' if os.path.isdir(local_path) else ''
|
||||||
res = local('{}cp {} {} {}'.format(pre_cmd, opts, local_path, remote_path))
|
res = local('{}cp {} {} {}'.format(pre_cmd, opts, local_path, remote_path))
|
||||||
else: # docker
|
else: # docker
|
||||||
res = local('sudo docker cp {} {}:{}'.format(local_path, dconf.CONTAINER_NAME, remote_path))
|
res = local('docker cp {} {}:{}'.format(local_path, dconf.CONTAINER_NAME, remote_path))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,12 @@ class ConfigurationRecommendation(UpdateTask): # pylint: disable=abstract-metho
|
||||||
result_id = retval['result_id']
|
result_id = retval['result_id']
|
||||||
result = Result.objects.get(pk=result_id)
|
result = Result.objects.get(pk=result_id)
|
||||||
|
|
||||||
|
# Create next configuration to try
|
||||||
|
config = db.parser.create_knob_configuration(result.dbms.pk, retval['recommendation'])
|
||||||
|
retval['recommendation'] = config
|
||||||
|
result.next_configuration = JSONUtil.dumps(retval)
|
||||||
|
result.save()
|
||||||
|
|
||||||
# Replace result with formatted result
|
# Replace result with formatted result
|
||||||
formatted_params = db.parser.format_dbms_knobs(result.dbms.pk, retval['recommendation'])
|
formatted_params = db.parser.format_dbms_knobs(result.dbms.pk, retval['recommendation'])
|
||||||
task_meta = TaskMeta.objects.get(task_id=task_id)
|
task_meta = TaskMeta.objects.get(task_id=task_id)
|
||||||
|
@ -117,12 +123,6 @@ class ConfigurationRecommendation(UpdateTask): # pylint: disable=abstract-metho
|
||||||
task_meta.result = retval
|
task_meta.result = retval
|
||||||
task_meta.save()
|
task_meta.save()
|
||||||
|
|
||||||
# Create next configuration to try
|
|
||||||
config = db.parser.create_knob_configuration(result.dbms.pk, retval['recommendation'])
|
|
||||||
retval['recommendation'] = config
|
|
||||||
result.next_configuration = JSONUtil.dumps(retval)
|
|
||||||
result.save()
|
|
||||||
|
|
||||||
|
|
||||||
def clean_knob_data(knob_matrix, knob_labels, session):
|
def clean_knob_data(knob_matrix, knob_labels, session):
|
||||||
# Makes sure that all knobs in the dbms are included in the knob_matrix and knob_labels
|
# Makes sure that all knobs in the dbms are included in the knob_matrix and knob_labels
|
||||||
|
|
|
@ -491,17 +491,7 @@ def handle_result_files(session, files):
|
||||||
for knob in data_knobs.keys():
|
for knob in data_knobs.keys():
|
||||||
for tunable_knob in last_conf.keys():
|
for tunable_knob in last_conf.keys():
|
||||||
if tunable_knob in knob:
|
if tunable_knob in knob:
|
||||||
unit = KnobCatalog.objects.get(dbms=session.dbms, name=knob).unit
|
data_knobs[knob] = last_conf[tunable_knob]
|
||||||
bytes_system = ConversionUtil.DEFAULT_BYTES_SYSTEM
|
|
||||||
time_system = ConversionUtil.DEFAULT_TIME_SYSTEM
|
|
||||||
if unit == 1:
|
|
||||||
data_knobs[knob] = ConversionUtil.get_raw_size(last_conf[tunable_knob],
|
|
||||||
bytes_system)
|
|
||||||
elif unit == 2:
|
|
||||||
data_knobs[knob] = ConversionUtil.get_raw_size(last_conf[tunable_knob],
|
|
||||||
time_system)
|
|
||||||
else:
|
|
||||||
data_knobs[knob] = last_conf[tunable_knob]
|
|
||||||
|
|
||||||
knob_data.data = JSONUtil.dumps(data_knobs)
|
knob_data.data = JSONUtil.dumps(data_knobs)
|
||||||
knob_data.name = knob_data.name + '*'
|
knob_data.name = knob_data.name + '*'
|
||||||
|
|
Loading…
Reference in New Issue