common: add new criteria operator bt
PATCH 1/1 common: add new criteria operator bt
Add new criteria operator bt to support that criteria check result is pass when ouput value is between min value and max value. e.g. of criteria file
"reference":{
"value":"7.5-10.5",
"operator":"bt"}
--- engine/scripts/parser/common.py | 20 +++++--- engine/scripts/parser/prepare_chart_data.py | 79 +++++++++++++++++++++-------- 2 files changed, 69 insertions(+), 30 deletions(-)
engine/scripts/parser/common.py +12 -8
@@ -158,17 +158,19 @@ def check_measure(tguid, criteria_data, measure): return 'SKIP' if reference['operator'] == 'lt': - result = measure['measure'] < reference["value"] + result = measure['measure'] < float(reference["value"]) elif reference['operator'] == 'le': - result = measure['measure'] <= reference["value"] + result = measure['measure'] <= float(reference["value"]) elif reference['operator'] == 'gt': - result = measure['measure'] > reference["value"] + result = measure['measure'] > float(reference["value"]) elif reference['operator'] == 'ge': - result = measure['measure'] >= reference["value"] + result = measure['measure'] >= float(reference["value"]) elif reference['operator'] == 'eq': - result = measure['measure'] == reference["value"] + result = measure['measure'] == float(reference["value"]) elif reference['operator'] == 'ne': - result = measure['measure'] != reference["value"] + result = measure['measure'] != float(reference["value"]) + elif reference['operator'] == 'bt': + result = measure['measure'] >= float(reference["value"].split('-')[0]) and measure['measure'] <= float(reference["value"].split('-')[1]) status = 'PASS' if result else 'FAIL' dprint(" result=%s" % result)
@@ -283,7 +285,7 @@ def convert_reference_log_to_criteria(filename): old_measure_id, operation = crit_str.split("|") ts_name, tc_name, measure_name = split_old_id(old_measure_id) tguid = "%s.%s.%s" % (ts_name, tc_name, measure_name) - value = float(lines[i+1]) + value = lines[i+1] reference = {"value":value, "operator": operation.strip()} crit = {"tguid":tguid, "reference": reference }
@@ -568,15 +570,17 @@ def process(results={}): update_results_json(test_logdir, TESTDIR, REF_JSON) ref_map = {} + op_map = {} for crit in criteria_data["criteria"]: # not all criteria are measure reference thresholds try: ref_map[crit["tguid"]] = crit["reference"]["value"] + op_map[crit["tguid"]] = crit["reference"]["operator"] except: # ignore other data pass - data_lines = store_flat_results(test_logdir, run_data, ref_map) + data_lines = store_flat_results(test_logdir, run_data, ref_map, op_map) make_chart_data(test_logdir, TESTDIR, CHART_CONFIG_JSON, data_lines) status = run_data.get('status', 'FAIL')
engine/scripts/parser/prepare_chart_data.py +57 -22
144 lines not on this page · raw message
Signature · 1 line
2.7.4
Quoted 8 lines
-----Original Message-----
From: Qiu TingtingAdd new criteria operator bt to support that criteria check result is pass when ouput value is between min value and max value.
e.g. of criteria file"reference":{ "value":"7.5-10.5",
'-' is not a good range delimiter here, because it could be used as part of a number value (for a negative number).
Possibly ',' would work, but this patch is quite involved and I didn't have time to test it.
See more explanation below.
Quoted 29 lines
"operator":"bt"}
Signed-off-by Qiu Tingting <[email protected]>--- engine/scripts/parser/common.py | 20 +++++--- engine/scripts/parser/prepare_chart_data.py | 79 +++++++++++++++++++++-------- 2 files changed, 69 insertions(+), 30 deletions(-)engine/scripts/parser/common.py +3
-4@@ -158,17 +158,19 @@ def check_measure(tguid, criteria_data, measure): return 'SKIP' if reference['operator'] == 'lt': - result = measure['measure'] < reference["value"] + result = measure['measure'] < float(reference["value"]) elif reference['operator'] == 'le': - result = measure['measure'] <= reference["value"] + result = measure['measure'] <= float(reference["value"]) elif reference['operator'] == 'gt': - result = measure['measure'] > reference["value"] + result = measure['measure'] > float(reference["value"]) elif reference['operator'] == 'ge': - result = measure['measure'] >= reference["value"]
engine/scripts/parser/common.py def check_measure(tguid, criteria_data, measure): · line 174
Quoted 10 lines
engine/scripts/parser/common.py +5
-2+ result = measure['measure'] >= float(reference["value"]) elif reference['operator'] == 'eq': - result = measure['measure'] == reference["value"] + result = measure['measure'] == float(reference["value"]) elif reference['operator'] == 'ne': - result = measure['measure'] != reference["value"] + result = measure['measure'] != float(reference["value"]) + elif reference['operator'] == 'bt': + result = measure['measure'] >= float(reference["value"].split('-')[0]) and measure['measure'] <= float(reference["value"].split('-')[1])
splitting on '-' I problematical, because it will cause problems with negative numbers.
For example, this code will fail with the range "-7--3"
I changed the range delimiter to ',' so the above could be expressed as:
"-7,-3"
Quoted 116 lines
engine/scripts/parser/common.py +0
-0status = 'PASS' if result else 'FAIL'
dprint(" result=%s" % result)engine/scripts/parser/common.py +4
-2@@ -283,7 +285,7 @@ def convert_reference_log_to_criteria(filename): old_measure_id, operation = crit_str.split("|") ts_name, tc_name, measure_name = split_old_id(old_measure_id) tguid = "%s.%s.%s" % (ts_name, tc_name, measure_name) - value = float(lines[i+1]) + value = lines[i+1] reference = {"value":value, "operator": operation.strip()} crit = {"tguid":tguid, "reference": reference }@@ -568,15 +570,17 @@ def process(results={}): update_results_json(test_logdir, TESTDIR, REF_JSON) ref_map = {} + op_map = {} for crit in criteria_data["criteria"]: # not all criteria are measure reference thresholds try: ref_map[crit["tguid"]] = crit["reference"]["value"] + op_map[crit["tguid"]] = crit["reference"]["operator"] except: # ignore other data pass - data_lines = store_flat_results(test_logdir, run_data, ref_map) + data_lines = store_flat_results(test_logdir, run_data, ref_map, op_map) make_chart_data(test_logdir, TESTDIR, CHART_CONFIG_JSON, data_lines) status = run_data.get('status', 'FAIL')engine/scripts/parser/prepare_chart_data.py +8
-4@@ -66,9 +66,10 @@ class flat_entry: self.tguid = \ self.test_set = \ self.ref = \ + self.op = \ self.result = "ERROR-undefined" parts = line.split() - if len(parts) != 9: + if len(parts) < 9: print("Error reading line '%s' in prepare_chart_data.py" % line) print("Possible data corruption in flat_plot_data.txt")@@ -81,6 +82,7 @@ class flat_entry: self.kernel = parts[5] self.tguid = parts[6] self.ref = parts[7] + self.op = parts[9] self.result = parts[8] # break apart tguid@@ -103,10 +105,10 @@ class flat_entry: pass def __str__(self): - return "%s %s %s %s %s %s %s %s\n" % \ + return "%s %s %s %s %s %s %s %s %s\n" % \ (self.board, self.testname, self.spec, self.build_number, self.timestamp, self.kernel, self.tguid, self.ref, - self.result) + self.result, self.op) def get_chart_config(TESTDIR, chart_config_filename): try:@@ -146,10 +148,12 @@ def reread_run_json_files(TESTDIR): # and possibly FUEGO_CRITERIA_JSON_PATH) criteria_data = load_criteria() ref_map = {} + op_map = {} for crit in criteria_data["criteria"]: # not all criteria are measure reference thresholds try: ref_map[crit["tguid"]] = crit["reference"]["value"] + op_map[crit["tguid"]] = crit["reference"]["operator"] except: # ignore other data pass@@ -162,7 +166,7 @@ def reread_run_json_files(TESTDIR): # read run_data with open(run_filename) as run_file: run_data = json.load(run_file, object_pairs_hook=collections.OrderedDict) - store_flat_results(test_logdir, run_data, ref_map) + store_flat_results(test_logdir, run_data, ref_map, op_map) # Store tguid results in a flat list, space-separated# this is stored in a file called flat_plot_data.txt in the test directoryengine/scripts/parser/prepare_chart_data.py +1
-1@@ -173,7 +177,7 @@ def reread_run_json_files(TESTDIR): # # returns the list of lines in the updated flat results file -def store_flat_results(test_logdir, run_data, ref_map): +def store_flat_results(test_logdir, run_data, ref_map, op_map): # test log dir is up one directory plot_data_filename=test_logdir+"/flat_plot_data.txt"@@ -212,7 +216,7 @@ def store_flat_results(test_logdir, run_data,
ref_map):return dprint("ref_map=%s" % ref_map)engine/scripts/parser/prepare_chart_data.py +1
-1- + dprint("op_map=%s" % op_map) for test_set in test_sets: ts_name = test_set["name"] test_cases = test_set["test_cases"]@@ -245,11 +249,13 @@ def store_flat_results(test_logdir, run_data,
ref_map):
except:
try:
m_ref= ref_map[tguid]
engine/scripts/parser/prepare_chart_data.py def store_flat_results(test_logdir, run_data, ref_map): · line 256
Quoted 6 lines
engine/scripts/parser/prepare_chart_data.py +3
-1+ m_op = op_map[tguid] except: m_ref = 0 - line = "%s %s %s %s %s %s %s %s %s\n" % \ + m_op = "none" + line = "%s %s %s %s %s %s %s %s %s %s\n" % \
OK - this is a lot of extra work and overhead (including the op for every criteria reference, for every measure of every benchmark), to support just a single operator ('bt') which might not be used that much.
It appears to me that this is only used one place in the make_measure_plot code (the 'if entry.op == '"bt"'). Could you detect this automatically if the ref value had a ',' in it? This would save having to extend the flat_plot_data by an extra field, which is desirable.
Quoted 16 lines
(board,
test_name,test_spec,build_number, timestamp,engine/scripts/parser/prepare_chart_data.py +1
-1- kernel, tguid, m_ref, m_result) + kernel, tguid, m_ref, m_result, m_op) plot_file.write(line) data_lines.append(line)@@ -319,20 +325,49 @@ def make_measure_plots(test_name,
chart_config, entries):
ref_series_key=series_key+ "-ref"engine/scripts/parser/prepare_chart_data.py +0
-5- dprint("ref_series_key=%s" % ref_series_key) - - if ref_series_key not in series_map: - dprint("making a new series for '%s'" % ref_series_key) - series_map[ref_series_key] = { "label": ref_series_key,
engine/scripts/parser/prepare_chart_data.py def make_measure_plots(test_name, chart_config, entries): · line 328
Quoted 10 lines
engine/scripts/parser/prepare_chart_data.py +1
-9- "data": [], - "points": {"symbol": "cross"} } - # add a plot point for this ref entry - try: - value = float(entry.ref) - except: - value = 0 - point = [entry.build_number, value] - series_map[ref_series_key]["data"].append(point) + if entry.op == "bt":
Maybe detect this case with 'if ',' in entry.ref:' instead of adding a whole field to flat_plot_data.txt
engine/scripts/parser/prepare_chart_data.py def make_measure_plots(test_name, chart_config, entries): · line 338
Quoted 10 lines
engine/scripts/parser/prepare_chart_data.py +10
-0+ ref_min_series_key = ref_series_key + "-min" + dprint("ref_min_series_key=%s" % ref_min_series_key) + if ref_min_series_key not in series_map: + # add a plot point for this ref min entry + dprint("making a new series for '%s'" % ref_min_series_key) + series_map[ref_min_series_key] = { "label": ref_min_series_key, + "data": [], + "points": {"symbol": "cross"} } + try: + min_value = float(entry.ref.split('-')[0])
This would require changing also.
engine/scripts/parser/prepare_chart_data.py def make_measure_plots(test_name, chart_config, entries): · line 344
Quoted 6 lines
engine/scripts/parser/prepare_chart_data.py +6
-0+ except: + min_value = 0 + point = [entry.build_number, min_value] + series_map[ref_min_series_key]["data"].append(point) + try: + max_value = float(entry.ref.split('-')[1])
This would require changing also.
Quoted 31 lines
engine/scripts/parser/prepare_chart_data.py +8
-0+ except: + max_value = None + ref_max_series_key = ref_series_key + "-max" + dprint("ref_max_series_key=%s" % ref_max_series_key) + if ref_max_series_key not in series_map: + # add a plot point for this ref max entry + dprint("making a new series for '%s'" % ref_max_series_key) + series_map[ref_max_series_key] = { "label":
ref_max_series_key,engine/scripts/parser/prepare_chart_data.py +18
-1+ "data": [], + "points": {"symbol": "cross"} } + point = [entry.build_number, max_value] + series_map[ref_max_series_key]["data"].append(point) + else: + dprint("ref_series_key=%s" % ref_series_key) + if ref_series_key not in series_map: + # add a plot point for this ref entry + dprint("making a new series for '%s'" % ref_series_key) + series_map[ref_series_key] = { "label": ref_series_key, + "data": [], + "points": {"symbol": "cross"} } + try: + value = float(entry.ref) + except: + value = 0 + point = [entry.build_number, value] + series_map[ref_series_key]["data"].append(point) flot_data = series_map.values() flot_data.sort(key=itemgetter('label')) --
Quoted 1 line
2.7.4
OK - this is horrible of me, but I'm short on time. I applied the patch, and changed the delimiter to ','. But I haven't had time to test it.
Can you please consider the change I recommend above, as well as test this code, which I just pushed to master, to see if anything broke.
I also did a refactoring patch on top of this, for check_measure, to make it a bit simpler.
Please take a look.
Thanks,
-- Tim
Hi, Tim
Thank you for your amendment. Indeed, ',' is better.
Quoted 9 lines
OK - this is a lot of extra work and overhead (including the op for every criteria reference, for every measure of every benchmark), to support just a single operator ('bt') which might not be used that much.
It appears to me that this is only used one place in the
make_measure_plotcode (the 'if entry.op == '"bt"'). Could you detect this automatically if the ref value had a ',' in it? This would save having to extend theflat_plot_data
by an extra field, which is desirable.
You are right, we can use 'entry.ref' instead of 'entry.op' here,
but I also considered using 'entry.op' or 'entry.ref' of the if code. Finally, 'entry.op' is selected because:
1.The 'entry.op' is easier to understand.
2.Maybe there will be other special operates in future. The 'entry.op' is easier to extend.
Quoted 7 lines
Can you please consider the change I recommend above, as well as test this code, which I just pushed to master, to see if anything broke.
I also did a refactoring patch on top of this, for
check_measure, to make it a bit simpler.Please take a look.
I tested it briefly. It works very well.
Regards,
Qiu Tingting
Quoted 311 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Friday, September 28, 2018 3:35 AM
To: Qiu, Tingting/仇 婷婷; [email protected]
Subject: RE: [Fuego] [PATCH] common: add new criteria operator btQuoted 4 lines
-----Original Message-----
From: Qiu TingtingAdd new criteria operator bt to support that criteria check result is pass
when
Quoted 4 lines
ouput value is between min value and max value.
e.g. of criteria file"reference":{ "value":"7.5-10.5",'-' is not a good range delimiter here, because it could be used as part of a number value (for a negative number).
Possibly ',' would work, but this patch is quite involved and I didn't have time to test it.See more explanation below.
Quoted 28 lines
"operator":"bt"}
Signed-off-by Qiu Tingting <[email protected]>--- engine/scripts/parser/common.py | 20 +++++--- engine/scripts/parser/prepare_chart_data.py | 79 +++++++++++++++++++++-------- 2 files changed, 69 insertions(+), 30 deletions(-)engine/scripts/parser/common.py +3
-3@@ -158,17 +158,19 @@ def check_measure(tguid, criteria_data, measure): return 'SKIP' if reference['operator'] == 'lt': - result = measure['measure'] < reference["value"] + result = measure['measure'] < float(reference["value"]) elif reference['operator'] == 'le': - result = measure['measure'] <= reference["value"] + result = measure['measure'] <= float(reference["value"]) elif reference['operator'] == 'gt': - result = measure['measure'] > reference["value"] + result = measure['measure'] > float(reference["value"]) elif reference['operator'] == 'ge':engine/scripts/parser/common.py def check_measure(tguid, criteria_data, measure): · line 173
Quoted 10 lines
engine/scripts/parser/common.py +5
-3- result = measure['measure'] >= reference["value"] + result = measure['measure'] >= float(reference["value"]) elif reference['operator'] == 'eq': - result = measure['measure'] == reference["value"] + result = measure['measure'] == float(reference["value"]) elif reference['operator'] == 'ne': - result = measure['measure'] != reference["value"] + result = measure['measure'] != float(reference["value"]) + elif reference['operator'] == 'bt': + result = measure['measure'] >=float(reference["value"].split('-')[0])
engine/scripts/parser/common.py def check_measure(tguid, criteria_data, measure): · line 174
Quoted 1 line
engine/scripts/parser/common.py +0
-0and measure['measure'] <= float(reference["value"].split('-')[1])splitting on '-' I problematical, because it will cause problems with negative numbers.
For example, this code will fail with the range "-7--3"
I changed the range delimiter to ',' so the above could be expressed as:
"-7,-3"engine/scripts/parser/common.py def convert_reference_log_to_criteria(filename): · line 286
Quoted 6 lines
engine/scripts/parser/common.py +0
-0status = 'PASS' if result else 'FAIL'
dprint(" result=%s" % result)engine/scripts/parser/common.py +0
-0@@ -283,7 +285,7 @@ def convert_reference_log_to_criteria(filename): old_measure_id, operation = crit_str.split("|") ts_name, tc_name, measure_name =
split_old_id(old_measure_id)Quoted 12 lines
engine/scripts/parser/common.py +2
-1tguid = "%s.%s.%s" % (ts_name, tc_name, measure_name) - value = float(lines[i+1]) + value = lines[i+1] reference = {"value":value, "operator": operation.strip()} crit = {"tguid":tguid, "reference": reference }@@ -568,15 +570,17 @@ def process(results={}): update_results_json(test_logdir, TESTDIR, REF_JSON) ref_map = {} + op_map = {} for crit in criteria_data["criteria"]:engine/scripts/parser/common.py def process(results={}): · line 583
Quoted 10 lines
engine/scripts/parser/common.py +2
-1# not all criteria are measure reference thresholds try: ref_map[crit["tguid"]] = crit["reference"]["value"] + op_map[crit["tguid"]] = crit["reference"]["operator"] except: # ignore other data pass - data_lines = store_flat_results(test_logdir, run_data, ref_map) + data_lines = store_flat_results(test_logdir, run_data, ref_map,
op_map)Quoted 9 lines
engine/scripts/parser/common.py +0
-0make_chart_data(test_logdir, TESTDIR, CHART_CONFIG_JSON, data_lines) status = run_data.get('status', 'FAIL')engine/scripts/parser/prepare_chart_data.py +0
-0engine/scripts/parser/prepare_chart_data.py class flat_entry: · line 73
Quoted 9 lines
engine/scripts/parser/prepare_chart_data.py +2
-1@@ -66,9 +66,10 @@ class flat_entry: self.tguid = \ self.test_set = \ self.ref = \ + self.op = \ self.result = "ERROR-undefined" parts = line.split() - if len(parts) != 9: + if len(parts) < 9: print("Error reading line '%s' in prepare_chart_data.py" %line)
Quoted 11 lines
engine/scripts/parser/prepare_chart_data.py +1
-0print("Possible data corruption in flat_plot_data.txt")@@ -81,6 +82,7 @@ class flat_entry: self.kernel = parts[5] self.tguid = parts[6] self.ref = parts[7] + self.op = parts[9] self.result = parts[8] # break apart tguidengine/scripts/parser/prepare_chart_data.py class flat_entry: · line 109
Quoted 6 lines
engine/scripts/parser/prepare_chart_data.py +1
-1@@ -103,10 +105,10 @@ class flat_entry: pass def __str__(self): - return "%s %s %s %s %s %s %s %s\n" % \ + return "%s %s %s %s %s %s %s %s %s\n" % \ (self.board, self.testname, self.spec,self.build_number,
Quoted 53 lines
engine/scripts/parser/prepare_chart_data.py +4
-2self.timestamp, self.kernel, self.tguid, self.ref, - self.result) + self.result, self.op) def get_chart_config(TESTDIR, chart_config_filename): try:@@ -146,10 +148,12 @@ def reread_run_json_files(TESTDIR): # and possibly FUEGO_CRITERIA_JSON_PATH) criteria_data = load_criteria() ref_map = {} + op_map = {} for crit in criteria_data["criteria"]: # not all criteria are measure reference thresholds try: ref_map[crit["tguid"]] = crit["reference"]["value"] + op_map[crit["tguid"]] = crit["reference"]["operator"] except: # ignore other data pass@@ -162,7 +166,7 @@ def reread_run_json_files(TESTDIR): # read run_data with open(run_filename) as run_file: run_data = json.load(run_file, object_pairs_hook=collections.OrderedDict) - store_flat_results(test_logdir, run_data, ref_map) + store_flat_results(test_logdir, run_data, ref_map, op_map) # Store tguid results in a flat list, space-separated# this is stored in a file called flat_plot_data.txt in the test directoryengine/scripts/parser/prepare_chart_data.py +1
-1@@ -173,7 +177,7 @@ def reread_run_json_files(TESTDIR): # # returns the list of lines in the updated flat results file -def store_flat_results(test_logdir, run_data, ref_map): +def store_flat_results(test_logdir, run_data, ref_map, op_map): # test log dir is up one directory plot_data_filename=test_logdir+"/flat_plot_data.txt"@@ -212,7 +216,7 @@ def store_flat_results(test_logdir, run_data,
ref_map):return dprint("ref_map=%s" % ref_map)engine/scripts/parser/prepare_chart_data.py +1
-1- + dprint("op_map=%s" % op_map) for test_set in test_sets: ts_name = test_set["name"] test_cases = test_set["test_cases"]@@ -245,11 +249,13 @@ def store_flat_results(test_logdir, run_data,
ref_map):
except:
try:
m_ref= ref_map[tguid]engine/scripts/parser/prepare_chart_data.py def store_flat_results(test_logdir, run_data, ref_map): · line 256
Quoted 6 lines
engine/scripts/parser/prepare_chart_data.py +3
-1+ m_op = op_map[tguid] except: m_ref = 0 - line = "%s %s %s %s %s %s %s %s %s\n" % \ + m_op = "none" + line = "%s %s %s %s %s %s %s %s %s %s\n" % \OK - this is a lot of extra work and overhead (including the op for every criteria reference, for every measure of every benchmark), to support just a single operator ('bt') which might not be used that much.
It appears to me that this is only used one place in the
make_measure_plotcode (the 'if entry.op == '"bt"'). Could you detect this automatically if the ref value had a ',' in it? This would save having to extend theflat_plot_data
by an extra field, which is desirable.Quoted 1 line
(board,
test_name,test_spec,build_number,timestamp,
Quoted 15 lines
engine/scripts/parser/prepare_chart_data.py +1
-1- kernel, tguid, m_ref, m_result) + kernel, tguid, m_ref, m_result, m_op) plot_file.write(line) data_lines.append(line)@@ -319,20 +325,49 @@ def make_measure_plots(test_name,
chart_config, entries):
ref_series_key=series_key+ "-ref"engine/scripts/parser/prepare_chart_data.py +0
-5- dprint("ref_series_key=%s" % ref_series_key) - - if ref_series_key not in series_map: - dprint("making a new series for '%s'" % ref_series_key) - series_map[ref_series_key] = { "label": ref_series_key,engine/scripts/parser/prepare_chart_data.py def make_measure_plots(test_name, chart_config, entries): · line 328
Quoted 10 lines
engine/scripts/parser/prepare_chart_data.py +1
-9- "data": [], - "points": {"symbol": "cross"} } - # add a plot point for this ref entry - try: - value = float(entry.ref) - except: - value = 0 - point = [entry.build_number, value] - series_map[ref_series_key]["data"].append(point) + if entry.op == "bt":Maybe detect this case with 'if ',' in entry.ref:' instead of adding a whole field to flat_plot_data.txt
engine/scripts/parser/prepare_chart_data.py def make_measure_plots(test_name, chart_config, entries):
Quoted 5 lines
engine/scripts/parser/prepare_chart_data.py +5
-0+ ref_min_series_key = ref_series_key + "-min" + dprint("ref_min_series_key=%s" % ref_min_series_key) + if ref_min_series_key not in series_map: + # add a plot point for this ref min entry + dprint("making a new series for '%s'" %
ref_min_series_key)Quoted 1 line
+ series_map[ref_min_series_key] = { "label":
ref_min_series_key,engine/scripts/parser/prepare_chart_data.py def make_measure_plots(test_name, chart_config, entries): · line 338
Quoted 4 lines
engine/scripts/parser/prepare_chart_data.py +4
-0+ "data": [], + "points": {"symbol": "cross"} } + try: + min_value = float(entry.ref.split('-')[0])This would require changing also.
engine/scripts/parser/prepare_chart_data.py def make_measure_plots(test_name, chart_config, entries): · line 344
Quoted 6 lines
engine/scripts/parser/prepare_chart_data.py +6
-0+ except: + min_value = 0 + point = [entry.build_number, min_value] + series_map[ref_min_series_key]["data"].append(point) + try: + max_value = float(entry.ref.split('-')[1])This would require changing also.
engine/scripts/parser/prepare_chart_data.py def make_measure_plots(test_name, chart_config, entries):
Quoted 7 lines
engine/scripts/parser/prepare_chart_data.py +7
-0+ except: + max_value = None + ref_max_series_key = ref_series_key + "-max" + dprint("ref_max_series_key=%s" % ref_max_series_key) + if ref_max_series_key not in series_map: + # add a plot point for this ref max entry + dprint("making a new series for '%s'" %
ref_max_series_key)engine/scripts/parser/prepare_chart_data.py def make_measure_plots(test_name, chart_config, entries):
Quoted 11 lines
+ series_map[ref_max_series_key] = { "label":
ref_max_series_key,engine/scripts/parser/prepare_chart_data.py +9
-0+ "data": [], + "points": {"symbol": "cross"} } + point = [entry.build_number, max_value] + series_map[ref_max_series_key]["data"].append(point) + else: + dprint("ref_series_key=%s" % ref_series_key) + if ref_series_key not in series_map: + # add a plot point for this ref entry + dprint("making a new series for '%s'" %
ref_series_key)Quoted 1 line
+ series_map[ref_series_key] = { "label":
ref_series_key,Quoted 12 lines
engine/scripts/parser/prepare_chart_data.py +8
-1+ "data": [], + "points": {"symbol": "cross"} } + try: + value = float(entry.ref) + except: + value = 0 + point = [entry.build_number, value] + series_map[ref_series_key]["data"].append(point) flot_data = series_map.values() flot_data.sort(key=itemgetter('label')) --Quoted 1 line
2.7.4
OK - this is horrible of me, but I'm short on time. I applied the patch, and changed the delimiter to ','. But I haven't had time to test it.
Can you please consider the change I recommend above, as well as test this code, which I just pushed to master, to see if anything broke.
I also did a refactoring patch on top of this, for
check_measure, to make it a bit simpler.Please take a look.
Thanks,
-- Tim
Hi,Tim
I am very sorry for that I only tested Benchmark test for this modification last time。 When Functional test is tested, there is an error when working on make_testcase_table().
-----------
chart_config.json not available or is wrong format, using default values
Traceback (most recent call last):
File "/fuego-core/engine/tests/Functional.sdhi_0/parser.py", line 26, in <module> sys.exit(plib.process(results))
File "/fuego-core/engine/scripts/parser/common.py", line 598, in process make_chart_data(test_logdir, TESTDIR, CHART_CONFIG_JSON, data_lines)
File "/fuego-core/engine/scripts/parser/prepare_chart_data.py", line 756, in make_chart_data chart_list = make_testcase_table(test_name, chart_config, entries)
File "/fuego-core/engine/scripts/parser/prepare_chart_data.py", line 454, in make_testcase_table row_key = entry.test_case
AttributeError: flat_entry instance has no attribute 'test_case'
-----------
In functional test result, parts[9] of chart_data is not exist, so entry initialization can not be done. So, we may fix the problem like:
-----------
engine/scripts/parser/prepare_chart_data.py +4 -1
@@ -82,7 +82,10 @@ class flat_entry: self.kernel = parts[5] self.tguid = parts[6] self.ref = parts[7] - self.op = parts[9] + if len(parts) == 10: + self.op = parts[9] + else: + self.op = None self.result = parts[8] # break apart tguid
-----------
Regards,
Qiu Tingting
Quoted 360 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Qiu, Tingting
Sent: Friday, September 28, 2018 11:21 AM
To: [email protected]
Cc: [email protected]
Subject: Re: [Fuego] [PATCH] common: add new criteria operator btHi, Tim
Thank you for your amendment. Indeed, ',' is better.
Quoted 9 lines
OK - this is a lot of extra work and overhead (including the op for every criteria reference, for every measure of every benchmark), to support just a single operator ('bt') which might not be used that much.
It appears to me that this is only used one place in the
make_measure_plotcode (the 'if entry.op == '"bt"'). Could you detect this automatically if the ref value had a ',' in it? This would save having to extend theflat_plot_data
by an extra field, which is desirable.You are right, we can use 'entry.ref' instead of 'entry.op' here, but I also considered using 'entry.op' or 'entry.ref' of the if code. Finally, 'entry.op' is selected because:
1.The 'entry.op' is easier to understand.
2.Maybe there will be other special operates in future. The 'entry.op' is easier to extend.Quoted 7 lines
Can you please consider the change I recommend above, as well as test this code, which I just pushed to master, to see if anything broke.
I also did a refactoring patch on top of this, for
check_measure, to make it a bit simpler.Please take a look.
I tested it briefly. It works very well.
Regards,
Qiu TingtingQuoted 62 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Friday, September 28, 2018 3:35 AM
To: Qiu, Tingting/仇 婷婷; [email protected]
Subject: RE: [Fuego] [PATCH] common: add new criteria operator btQuoted 4 lines
-----Original Message-----
From: Qiu TingtingAdd new criteria operator bt to support that criteria check result is pass
when
Quoted 4 lines
ouput value is between min value and max value.
e.g. of criteria file"reference":{ "value":"7.5-10.5",'-' is not a good range delimiter here, because it could be used as part of a number value (for a negative number).
Possibly ',' would work, but this patch is quite involved and I didn't have time to test it.See more explanation below.
Quoted 28 lines
"operator":"bt"}
Signed-off-by Qiu Tingting <[email protected]>--- engine/scripts/parser/common.py | 20 +++++--- engine/scripts/parser/prepare_chart_data.py | 79 +++++++++++++++++++++-------- 2 files changed, 69 insertions(+), 30 deletions(-)engine/scripts/parser/common.py +3
-3@@ -158,17 +158,19 @@ def check_measure(tguid, criteria_data, measure): return 'SKIP' if reference['operator'] == 'lt': - result = measure['measure'] < reference["value"] + result = measure['measure'] < float(reference["value"]) elif reference['operator'] == 'le': - result = measure['measure'] <= reference["value"] + result = measure['measure'] <= float(reference["value"]) elif reference['operator'] == 'gt': - result = measure['measure'] > reference["value"] + result = measure['measure'] > float(reference["value"]) elif reference['operator'] == 'ge':engine/scripts/parser/common.py def check_measure(tguid, criteria_data, measure): · line 173
Quoted 10 lines
engine/scripts/parser/common.py +5
-3- result = measure['measure'] >= reference["value"] + result = measure['measure'] >= float(reference["value"]) elif reference['operator'] == 'eq': - result = measure['measure'] == reference["value"] + result = measure['measure'] == float(reference["value"]) elif reference['operator'] == 'ne': - result = measure['measure'] != reference["value"] + result = measure['measure'] != float(reference["value"]) + elif reference['operator'] == 'bt': + result = measure['measure'] >=float(reference["value"].split('-')[0])
Quoted 2 lines
engine/scripts/parser/common.py def check_measure(tguid, criteria_data, measure): · line 174
Quoted 1 line
engine/scripts/parser/common.py +0
-0and measure['measure'] <= float(reference["value"].split('-')[1])splitting on '-' I problematical, because it will cause problems with
negative
Quoted 34 lines
numbers.
For example, this code will fail with the range "-7--3"
I changed the range delimiter to ',' so the above could be expressed as:
"-7,-3"engine/scripts/parser/common.py def convert_reference_log_to_criteria(filename): · line 286
Quoted 6 lines
engine/scripts/parser/common.py +0
-0status = 'PASS' if result else 'FAIL'
dprint(" result=%s" % result)engine/scripts/parser/common.py +0
-0@@ -283,7 +285,7 @@ def convert_reference_log_to_criteria(filename): old_measure_id, operation = crit_str.split("|") ts_name, tc_name, measure_name =
split_old_id(old_measure_id)Quoted 20 lines
engine/scripts/parser/common.py +3
-1tguid = "%s.%s.%s" % (ts_name, tc_name, measure_name) - value = float(lines[i+1]) + value = lines[i+1] reference = {"value":value, "operator": operation.strip()} crit = {"tguid":tguid, "reference": reference }@@ -568,15 +570,17 @@ def process(results={}): update_results_json(test_logdir, TESTDIR, REF_JSON) ref_map = {} + op_map = {} for crit in criteria_data["criteria"]: # not all criteria are measure reference thresholds try: ref_map[crit["tguid"]] = crit["reference"]["value"] + op_map[crit["tguid"]] = crit["reference"]["operator"] except: # ignore other data passQuoted 4 lines
engine/scripts/parser/common.py def process(results={}): · line 583
Quoted 2 lines
engine/scripts/parser/common.py +1
-1- data_lines = store_flat_results(test_logdir, run_data, ref_map) + data_lines = store_flat_results(test_logdir, run_data, ref_map,
op_map)Quoted 1 line
engine/scripts/parser/common.py +0
-0make_chart_data(test_logdir, TESTDIR, CHART_CONFIG_JSON,
data_lines)Quoted 189 lines
Quoted 8 lines
engine/scripts/parser/common.py +0
-0status = run_data.get('status', 'FAIL')engine/scripts/parser/prepare_chart_data.py +0
-0engine/scripts/parser/prepare_chart_data.py class flat_entry: · line 73
Quoted 9 lines
engine/scripts/parser/prepare_chart_data.py +2
-1@@ -66,9 +66,10 @@ class flat_entry: self.tguid = \ self.test_set = \ self.ref = \ + self.op = \ self.result = "ERROR-undefined" parts = line.split() - if len(parts) != 9: + if len(parts) < 9: print("Error reading line '%s' in prepare_chart_data.py" %line)
Quoted 11 lines
engine/scripts/parser/prepare_chart_data.py +1
-0print("Possible data corruption in flat_plot_data.txt")@@ -81,6 +82,7 @@ class flat_entry: self.kernel = parts[5] self.tguid = parts[6] self.ref = parts[7] + self.op = parts[9] self.result = parts[8] # break apart tguidengine/scripts/parser/prepare_chart_data.py class flat_entry: · line 109
Quoted 6 lines
engine/scripts/parser/prepare_chart_data.py +1
-1@@ -103,10 +105,10 @@ class flat_entry: pass def __str__(self): - return "%s %s %s %s %s %s %s %s\n" % \ + return "%s %s %s %s %s %s %s %s %s\n" % \ (self.board, self.testname, self.spec,self.build_number,
Quoted 53 lines
engine/scripts/parser/prepare_chart_data.py +4
-2self.timestamp, self.kernel, self.tguid, self.ref, - self.result) + self.result, self.op) def get_chart_config(TESTDIR, chart_config_filename): try:@@ -146,10 +148,12 @@ def reread_run_json_files(TESTDIR): # and possibly FUEGO_CRITERIA_JSON_PATH) criteria_data = load_criteria() ref_map = {} + op_map = {} for crit in criteria_data["criteria"]: # not all criteria are measure reference thresholds try: ref_map[crit["tguid"]] = crit["reference"]["value"] + op_map[crit["tguid"]] = crit["reference"]["operator"] except: # ignore other data pass@@ -162,7 +166,7 @@ def reread_run_json_files(TESTDIR): # read run_data with open(run_filename) as run_file: run_data = json.load(run_file, object_pairs_hook=collections.OrderedDict) - store_flat_results(test_logdir, run_data, ref_map) + store_flat_results(test_logdir, run_data, ref_map, op_map) # Store tguid results in a flat list, space-separated# this is stored in a file called flat_plot_data.txt in the test directoryengine/scripts/parser/prepare_chart_data.py +1
-1@@ -173,7 +177,7 @@ def reread_run_json_files(TESTDIR): # # returns the list of lines in the updated flat results file -def store_flat_results(test_logdir, run_data, ref_map): +def store_flat_results(test_logdir, run_data, ref_map, op_map): # test log dir is up one directory plot_data_filename=test_logdir+"/flat_plot_data.txt"@@ -212,7 +216,7 @@ def store_flat_results(test_logdir, run_data,
ref_map):return dprint("ref_map=%s" % ref_map)engine/scripts/parser/prepare_chart_data.py +1
-1- + dprint("op_map=%s" % op_map) for test_set in test_sets: ts_name = test_set["name"] test_cases = test_set["test_cases"]@@ -245,11 +249,13 @@ def store_flat_results(test_logdir, run_data,
ref_map):
except:
try:
m_ref= ref_map[tguid]engine/scripts/parser/prepare_chart_data.py
Quoted 6 lines
engine/scripts/parser/prepare_chart_data.py +3
-1+ m_op = op_map[tguid] except: m_ref = 0 - line = "%s %s %s %s %s %s %s %s %s\n" % \ + m_op = "none" + line = "%s %s %s %s %s %s %s %s %s %s\n" % \OK - this is a lot of extra work and overhead (including the op for every criteria reference, for every measure of every benchmark), to support just a single operator ('bt') which might not be used that much.
It appears to me that this is only used one place in the
make_measure_plotcode (the 'if entry.op == '"bt"'). Could you detect this automatically if the ref value had a ',' in it? This would save having to extend theflat_plot_data
by an extra field, which is desirable.Quoted 1 line
(board,
test_name,test_spec,build_number,timestamp,
Quoted 15 lines
engine/scripts/parser/prepare_chart_data.py +1
-1- kernel, tguid, m_ref, m_result) + kernel, tguid, m_ref, m_result, m_op) plot_file.write(line) data_lines.append(line)@@ -319,20 +325,49 @@ def make_measure_plots(test_name,
chart_config, entries):
ref_series_key=series_key+ "-ref"engine/scripts/parser/prepare_chart_data.py +0
-5- dprint("ref_series_key=%s" % ref_series_key) - - if ref_series_key not in series_map: - dprint("making a new series for '%s'" % ref_series_key) - series_map[ref_series_key] = { "label": ref_series_key,engine/scripts/parser/prepare_chart_data.py
Quoted 10 lines
engine/scripts/parser/prepare_chart_data.py +1
-9- "data": [], - "points": {"symbol": "cross"} } - # add a plot point for this ref entry - try: - value = float(entry.ref) - except: - value = 0 - point = [entry.build_number, value] - series_map[ref_series_key]["data"].append(point) + if entry.op == "bt":Maybe detect this case with 'if ',' in entry.ref:' instead of adding a whole field to flat_plot_data.txt
engine/scripts/parser/prepare_chart_data.py
Quoted 5 lines
engine/scripts/parser/prepare_chart_data.py +5
-0+ ref_min_series_key = ref_series_key + "-min" + dprint("ref_min_series_key=%s" % ref_min_series_key) + if ref_min_series_key not in series_map: + # add a plot point for this ref min entry + dprint("making a new series for '%s'" %
ref_min_series_key)Quoted 1 line
+ series_map[ref_min_series_key] = { "label":
ref_min_series_key,engine/scripts/parser/prepare_chart_data.py
Quoted 4 lines
engine/scripts/parser/prepare_chart_data.py +4
-0+ "data": [], + "points": {"symbol": "cross"} } + try: + min_value = float(entry.ref.split('-')[0])This would require changing also.
engine/scripts/parser/prepare_chart_data.py
Quoted 6 lines
engine/scripts/parser/prepare_chart_data.py +6
-0+ except: + min_value = 0 + point = [entry.build_number, min_value] + series_map[ref_min_series_key]["data"].append(point) + try: + max_value = float(entry.ref.split('-')[1])This would require changing also.
engine/scripts/parser/prepare_chart_data.py
Quoted 7 lines
engine/scripts/parser/prepare_chart_data.py +7
-0+ except: + max_value = None + ref_max_series_key = ref_series_key + "-max" + dprint("ref_max_series_key=%s" % ref_max_series_key) + if ref_max_series_key not in series_map: + # add a plot point for this ref max entry + dprint("making a new series for '%s'" %
ref_max_series_key)engine/scripts/parser/prepare_chart_data.py
Quoted 11 lines
+ series_map[ref_max_series_key] = { "label":
ref_max_series_key,engine/scripts/parser/prepare_chart_data.py +9
-0+ "data": [], + "points": {"symbol": "cross"} } + point = [entry.build_number, max_value] + series_map[ref_max_series_key]["data"].append(point) + else: + dprint("ref_series_key=%s" % ref_series_key) + if ref_series_key not in series_map: + # add a plot point for this ref entry + dprint("making a new series for '%s'" %
ref_series_key)Quoted 1 line
+ series_map[ref_series_key] = { "label":
ref_series_key,Quoted 9 lines
engine/scripts/parser/prepare_chart_data.py +8
-0+ "data": [], + "points": {"symbol": "cross"} } + try: + value = float(entry.ref) + except: + value = 0 + point = [entry.build_number, value] + series_map[ref_series_key]["data"].append(point)Quoted 6 lines
Quoted 4 lines
flot_data=series_map.values()
flot_data.sort(key=itemgetter('label'))
--
2.7.4OK - this is horrible of me, but I'm short on time. I applied the patch,
and
Quoted 5 lines
changed the delimiter to ','. But I haven't had time to test it.
Can you please consider the change I recommend above, as well as test this code, which I just pushed to master, to see if anything broke.
Quoted 9 lines
I also did a refactoring patch on top of this, for
check_measure, to make it a bit simpler.Please take a look.
Thanks,
-- Tim_______________________________________________
Fuego mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fuego
Quoted 39 lines
-----Original Message-----
From: Qiu, TingtingHi,Tim
I am very sorry for that I only tested Benchmark test for this modification last time。
When Functional test is tested, there is an error when working onmake_testcase_table().
-----------
chart_config.json not available or is wrong format, using default values Traceback (most recent call last):
File "/fuego-core/engine/tests/Functional.sdhi_0/parser.py", line 26, in <module>
sys.exit(plib.process(results))
File "/fuego-core/engine/scripts/parser/common.py", line 598, in processmake_chart_data(test_logdir, TESTDIR, CHART_CONFIG_JSON, data_lines)File "/fuego-core/engine/scripts/parser/prepare_chart_data.py", line 756, inmake_chart_datachart_list=make_testcase_table(test_name, chart_config, entries)File "/fuego-core/engine/scripts/parser/prepare_chart_data.py", line 454, inmake_testcase_tablerow_key= entry.test_case
AttributeError:flat_entryinstance has no attribute 'test_case'
-----------
In functional test result, parts[9] ofchart_datais not exist, so entry initialization can not be done.
So, we may fix the problem like:
-----------engine/scripts/parser/prepare_chart_data.py +0
-0@@ -82,7 +82,10 @@ class flat_entry: self.kernel = parts[5] self.tguid = parts[6]
engine/scripts/parser/prepare_chart_data.py class flat_entry:
Quoted 10 lines
engine/scripts/parser/prepare_chart_data.py +4
-2self.ref = parts[7] - self.op = parts[9] + if len(parts) == 10: + self.op = parts[9] + else: + self.op = None self.result = parts[8] # break apart tguid -----------
Thank you for the bug report, but this is already fixed upstream. Are you using the latest master branch of Fuego?
I found this problem during testing of your patch, and added commit 35ff6895 to address it.
Here's the patch I used:
Subject: [PATCH] parser: parse 'op' separate from other fields
The 'bt' operation requires that the op field be passed in flat_plot_data.txt. However, this 10th field (field 9) is not present in previous instances of the file, for some lines.
Read the op field separately from the other fields, to avoid errors. The actual error seen was:
DEBUG: Making a chart for board: docker, test set: ERROR-undefined Traceback (most recent call last):
File "/fuego-core/engine/scripts/generic_parser.py", line 23, in
<module>
sys.exit(plib.process(results))
File "/fuego-core/engine/scripts/parser/common.py", line 595, in
process
make_chart_data(test_logdir, TESTDIR, CHART_CONFIG_JSON, data_lines)
File "/fuego-core/engine/scripts/parser/prepare_chart_data.py", line
756, in make_chart_data
chart_list = make_testcase_table(test_name, chart_config, entries)
File "/fuego-core/engine/scripts/parser/prepare_chart_data.py", line
454, in make_testcase_table
row_key = entry.test_case
AttributeError: flat_entry instance has no attribute 'test_case'
--- engine/scripts/parser/prepare_chart_data.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
engine/scripts/parser/prepare_chart_data.py +6 -1
@@ -82,7 +82,6 @@ class flat_entry: self.kernel = parts[5] self.tguid = parts[6] self.ref = parts[7] - self.op = parts[9] self.result = parts[8] # break apart tguid
@@ -104,6 +103,12 @@ class flat_entry: except: pass + # FIXTHIS - old files might not have the 'op' field, parse it separately + try: + self.op = parts[9] + except: + pass + def __str__(self): return "%s %s %s %s %s %s %s %s %s\n" % \ (self.board, self.testname, self.spec, self.build_number,
Signature · 1 line
2.1.4