- print(f"Time-ordered MRR values for parent build: {parent_values}")
- print(f"Time-ordered MRR values for current build: {current_values}")
- parent_values = hack(parent_values)
- current_values = hack(current_values)
- max_value = max([1.0] + parent_values + current_values)
- parent_stats = jumpavg.AvgStdevStats.for_runs(parent_values)
- current_stats = jumpavg.AvgStdevStats.for_runs(current_values)
- parent_group_list = jumpavg.BitCountingGroupList(
- max_value=max_value).append_group_of_runs([parent_stats])
- combined_group_list = parent_group_list.copy().extend_runs_to_last_group(
- [current_stats])
- separated_group_list = parent_group_list.append_group_of_runs(
- [current_stats])
- print(f"Value-ordered MRR values for parent build: {parent_values}")
- print(f"Value-ordered MRR values for current build: {current_values}")
- avg_diff = (current_stats.avg - parent_stats.avg) / parent_stats.avg
- print(f"Difference of averages relative to parent: {100 * avg_diff}%")
- print(f"Jumpavg representation of parent group: {parent_stats}")
- print(f"Jumpavg representation of current group: {current_stats}")
- print(
- f"Jumpavg representation of both as one group:"
- f" {combined_group_list[0].stats}"
- )
- bits_diff = separated_group_list.bits - combined_group_list.bits
- compared = u"longer" if bits_diff >= 0 else u"shorter"
- print(
- f"Separate groups are {compared} than single group"
- f" by {abs(bits_diff)} bits"
- )
- # TODO: Version of classify that takes max_value and list of stats?
- # That matters if only stats (not list of floats) are given.
- classified_list = jumpavg.classify([parent_values, current_values])
- if len(classified_list) < 2:
- print(f"Test test_index {test_index}: normal (no anomaly)")
- continue
- anomaly = classified_list[1].comment
- if anomaly == u"regression":
- print(f"Test test_index {test_index}: anomaly regression")
- exit_code = 3 # 1 or 2 can be caused by other errors
- continue
- print(f"Test test_index {test_index}: anomaly {anomaly}")
-print(f"Exit code: {exit_code}")
-sys.exit(exit_code)
+ # TODO: Version of classify that takes max_value and list of stats?
+ # That matters if only stats (not list of floats) are given.
+ classified_list = jumpavg.classify([parent_values, current_values])
+ if len(classified_list) < 2:
+ print(f"Test {name}: normal (no anomaly)")
+ continue
+ anomaly = classified_list[1].comment
+ if anomaly == "regression":
+ print(f"Test {name}: anomaly regression")
+ exit_code = 3 # 1 or 2 can be caused by other errors
+ continue
+ print(f"Test {name}: anomaly {anomaly}")
+ print(f"Exit code: {exit_code}")
+ return exit_code
+
+
+if __name__ == "__main__":
+ sys.exit(main())