address dana's comment

This commit is contained in:
yangdsh 2020-02-08 23:05:05 +00:00 committed by Dana Van Aken
parent c33625ca17
commit c69fca77d6
2 changed files with 6 additions and 7 deletions

View File

@ -663,12 +663,8 @@ def _http_content_to_json(content):
return json_content, decoded return json_content, decoded
def _parse_bool(val):
return str(val).lower() == 'true'
def _modify_website_object(obj_name, action, verbose=False, **kwargs): def _modify_website_object(obj_name, action, verbose=False, **kwargs):
verbose = _parse_bool(verbose) verbose = parse_bool(verbose)
if obj_name == 'project': if obj_name == 'project':
valid_actions = ('create', 'edit') valid_actions = ('create', 'edit')
elif obj_name == 'session': elif obj_name == 'session':

View File

@ -170,11 +170,14 @@ def aggregate_target_results(result_id, algorithm):
has_pipeline_data = PipelineData.objects.filter(workload=newest_result.workload).exists() has_pipeline_data = PipelineData.objects.filter(workload=newest_result.workload).exists()
if not has_pipeline_data or newest_result.session.tuning_session == 'lhs': if not has_pipeline_data or newest_result.session.tuning_session == 'lhs':
if not has_pipeline_data and newest_result.session.tuning_session == 'tuning_session': if not has_pipeline_data and newest_result.session.tuning_session == 'tuning_session':
LOG.debug("Background tasks haven't ran for this workload yet, picking random data.") LOG.debug("Background tasks haven't ran for this workload yet, picking data with lhs.")
all_samples = JSONUtil.loads(newest_result.session.lhs_samples) all_samples = JSONUtil.loads(newest_result.session.lhs_samples)
if len(all_samples) == 0: if len(all_samples) == 0:
knobs = SessionKnob.objects.get_knobs_for_session(newest_result.session) knobs = SessionKnob.objects.get_knobs_for_session(newest_result.session)
if newest_result.session.tuning_session == 'lhs':
all_samples = gen_lhs_samples(knobs, 100)
else:
all_samples = gen_lhs_samples(knobs, 10) all_samples = gen_lhs_samples(knobs, 10)
LOG.debug('%s: Generated LHS.\n\ndata=%s\n', LOG.debug('%s: Generated LHS.\n\ndata=%s\n',
AlgorithmType.name(algorithm), JSONUtil.dumps(all_samples[:5], pprint=True)) AlgorithmType.name(algorithm), JSONUtil.dumps(all_samples[:5], pprint=True))