Fixed bug in background task that happened when all workload data was invalid

This commit is contained in:
Dana Van Aken 2020-04-17 16:43:48 -04:00
parent 9cc119e129
commit ca63f91f55
1 changed files with 11 additions and 3 deletions

View File

@ -82,6 +82,8 @@ def run_background_tasks():
# Check that there are enough results in the workload # Check that there are enough results in the workload
LOG.info("Not enough results in workload %s (# results: %s, # required: %s).", LOG.info("Not enough results in workload %s (# results: %s, # required: %s).",
workload_name, num_wkld_results, MIN_WORKLOAD_RESULTS_COUNT) workload_name, num_wkld_results, MIN_WORKLOAD_RESULTS_COUNT)
workload.status = WorkloadStatusType.PROCESSED
workload.save()
continue continue
LOG.info("Aggregating data for workload %s...", workload_name) LOG.info("Aggregating data for workload %s...", workload_name)
@ -90,11 +92,17 @@ def run_background_tasks():
LOG.debug("Aggregated knob data: rowlabels=%s, columnlabels=%s, data=%s.", LOG.debug("Aggregated knob data: rowlabels=%s, columnlabels=%s, data=%s.",
len(knob_data['rowlabels']), len(knob_data['columnlabels']), len(knob_data['rowlabels']), len(knob_data['columnlabels']),
knob_data['data'].shape) knob_data['data'].shape)
LOG.debug("Aggregated metric data: rowlabels=%s, columnlabels=%s, data=%s.",
len(metric_data['rowlabels']), len(metric_data['columnlabels']),
metric_data['data'].shape)
LOG.info("Done aggregating data for workload %s.", workload_name) LOG.info("Done aggregating data for workload %s.", workload_name)
num_valid_results = knob_data['data'].shape[0]
if num_valid_results < MIN_WORKLOAD_RESULTS_COUNT:
# Check that there are enough valid results in the workload
LOG.info("Not enough valid results in workload %s (# valid results: %s, # required: %s).",
workload_name, num_valid_results, MIN_WORKLOAD_RESULTS_COUNT)
workload.status = WorkloadStatusType.PROCESSED
workload.save()
continue
# Knob_data and metric_data are 2D numpy arrays. Convert them into a # Knob_data and metric_data are 2D numpy arrays. Convert them into a
# JSON-friendly (nested) lists and then save them as new PipelineData # JSON-friendly (nested) lists and then save them as new PipelineData
# objects. # objects.