@@ -927,18 +927,17 @@ def refresh_task_status_statistics(conn):
927927 """delete from task_status_history where sent < now() - interval '30 days'"""
928928 )
929929 cursor .execute ("""delete from task_status_statistics""" )
930- # XXX waiting for more data before removing hard coded 'master' from here...
931930 cursor .execute ("""insert into task_status_statistics
932931 (branch_name, task_name, status, avg_elapsed, stddev_elapsed, n)
933- with elapsed as (select coalesce('master', build.branch_name) as branch_name,
932+ with elapsed as (select build.branch_name as branch_name,
934933 task.task_name,
935934 h.status,
936935 lead(h.sent) over(partition by h.task_id order by h.sent) - h.sent as elapsed
937936 from build
938937 join task using (build_id)
939938 join task_status_history h using (task_id)
940939 where task.status = 'COMPLETED'
941- --- and (build.branch_name = 'master' or build.branch_name like 'REL_%%')
940+ and (build.branch_name = 'master' or build.branch_name like 'REL_%%')
942941 )
943942 select branch_name,
944943 task_name,
@@ -948,8 +947,7 @@ def refresh_task_status_statistics(conn):
948947 count(elapsed) as n
949948 from elapsed
950949 where elapsed is not null
951- group by 1, 2, 3
952- --- having count(*) > 1""" )
950+ group by 1, 2, 3""" )
953951
954952
955953def refresh_build_status_statistics (conn ):
@@ -960,13 +958,13 @@ def refresh_build_status_statistics(conn):
960958 cursor .execute ("""delete from build_status_statistics""" )
961959 cursor .execute ("""insert into build_status_statistics
962960 (branch_name, status, avg_elapsed, stddev_elapsed, n)
963- with elapsed as (select coalesce('master', build.branch_name) as branch_name,
961+ with elapsed as (select build.branch_name as branch_name,
964962 h.status,
965963 lead(received) over (partition by h.build_id order by received) - received as elapsed
966964 from build_status_history h
967965 join build using (build_id)
968966 where build.status = 'COMPLETED'
969- --- and (build.branch_name = 'master' or build.branch_name like 'REL_%%')
967+ and (build.branch_name = 'master' or build.branch_name like 'REL_%%')
970968 )
971969 select branch_name,
972970 status,
@@ -975,8 +973,7 @@ def refresh_build_status_statistics(conn):
975973 count(elapsed) as n
976974 from elapsed
977975 where elapsed is not null
978- group by 1, 2
979- --- having count(*) > 1""" )
976+ group by 1, 2""" )
980977
981978
982979if __name__ == "__main__" :
0 commit comments