def find_the_most_stdev(size=10, days=182): title = f'top {size} test the most standard deviation in last {days} days' print(f'\n## {title}') # SUBSTRING_INDEX(SUBSTRING_INDEX(subset, ' ', 1), ' ', -1) AS task sql = f''' SELECT STDDEV(delta) as delta , SUBSTRING_INDEX(SUBSTRING_INDEX(subset, ':', 1), '/', -1) as task FROM xce_test_logs WHERE status = 'PASS' and DATEDIFF(NOW(), test_timestamp) <= {days} GROUP BY task order by delta desc limit {size} ''' task_list, volumn_list = query_with_fetchall(sql, size) horizontal_bar_chart(size, tasks=task_list, nums=volumn_list, title=title, xlabel='')
def find_take_the_most_time_group_by_subname(size=10, days=182): title = f'top {size} the most execution time in last {days} days' print(f'\n## {title}') # SUBSTRING_INDEX(SUBSTRING_INDEX(subset, ' ', 1), ' ', -1) AS task sql = f''' SELECT delta as delta, SUBSTRING_INDEX(SUBSTRING_INDEX(subset, ':', 1), '/', -1) as task FROM xce_test_logs WHERE status = 'PASS' and DATEDIFF(NOW(), test_timestamp) <= {days} GROUP BY task order by delta desc limit {size} ''' task_list, volumn_list = query_with_fetchall(sql, size) horizontal_bar_chart(size, tasks=task_list, nums=volumn_list, title=title, xlabel='(seconds)')
def find_take_the_most_time_in_pass_tests(size=10, days=182): title = f'top {size} the most execution time in last {days} days (PASS only)' print(f'\n## {title}') # SUBSTRING_INDEX(SUBSTRING_INDEX(subset, ' ', 1), ' ', -1) AS task sql = f''' SELECT a.delta as delta, a.subset as task FROM xce_test_logs a, xce_test_info b WHERE a.status = 'PASS' and DATEDIFF(NOW(), a.test_timestamp) <= {days} and b.result = 'SUCCESS' and a.build_number = b.id GROUP BY task order by delta desc limit {size}; ''' task_list, volumn_list = query_with_fetchall(sql, size) horizontal_bar_chart(size, tasks=task_list, nums=volumn_list, title=title, xlabel='(seconds)')
def find_fail_the_most_frequently(size=10, days=182): title = f'top {size} Fail the most frequently in last {days} days' print(f'\n## {title}') # SUBSTRING_INDEX(SUBSTRING_INDEX(subset, ' ', 1), ' ', -1) AS task sql = f''' SELECT count(*) as c, subset as task FROM xce_test_logs WHERE status = 'FAIL' and DATEDIFF(NOW(), test_timestamp) <= {days} GROUP BY task order by c desc limit {size} ''' task_list, volumn_list = query_with_fetchall(sql, size) horizontal_bar_chart(size, tasks=task_list, nums=volumn_list, title=title, xlabel='(times)')