@@ -781,19 +781,23 @@ def check_stale_builds(conn):
781781 #
782782 # This policy is quite conservative, but we don't want to poll too
783783 # often, or Cirrus might not like us, and 2 sigma should in theory only
784- # have to poll for 1% of branches spuriously...
784+ # have to poll for 0.3% of branches spuriously...
785+ #
786+ # Currently the refresh job combines all cf/* branches into one statistics
787+ # row and uses that as a reference for all cf/... branches, rather than
788+ # using master's statistics, because cf/* branches run on a different kind
789+ # of hardware for macOS. It seems to be a bit faster in EXECUTING, but
790+ # spend much longer in SCHEDULED.
785791 cursor .execute ("""with ref as (select branch_name,
786792 status,
787793 avg_elapsed + stddev_elapsed * 3 as elapsed_p99
788- from build_status_statistics
789- where branch_name = 'master' or branch_name like 'REL_%%'),
794+ from build_status_statistics),
790795 run as (select build_id,
791796 status,
792797 branch_name,
793798 case
794- when branch_name = 'master' or branch_name like 'REL_%%'
795- then branch_name
796- else 'master'
799+ when build.branch_name like 'cf/%%' then 'cf/*'
800+ else build.branch_name
797801 end as reference_branch,
798802 now() - created as elapsed
799803 from build
@@ -848,17 +852,15 @@ def check_stale_tasks(conn):
848852 task_name,
849853 status,
850854 avg_elapsed + stddev_elapsed * 3 as elapsed_p99
851- from task_status_statistics
852- where branch_name = 'master' or branch_name like 'REL_%%'),
855+ from task_status_statistics),
853856 run as (select task.task_id,
854857 task.build_id,
855858 task.task_name,
856859 task.status,
857860 build.branch_name,
858861 case
859- when build.branch_name = 'master' or build.branch_name like 'REL_%%'
860- then build.branch_name
861- else 'master'
862+ when build.branch_name like 'cf/%%' then 'cf/*'
863+ else build.branch_name
862864 end as reference_branch,
863865 now() - task.modified as elapsed
864866 from task join build using (build_id)
@@ -912,16 +914,17 @@ def refresh_task_status_statistics(conn):
912914 cursor .execute ("""delete from task_status_statistics""" )
913915 cursor .execute ("""insert into task_status_statistics
914916 (branch_name, task_name, status, avg_elapsed, stddev_elapsed, n)
915- with elapsed as (select build.branch_name as branch_name,
917+ with elapsed as (select case
918+ when build.branch_name like 'cf/%%' then 'cf/*'
919+ else branch_name
920+ end as branch_name,
916921 task.task_name,
917922 h.status,
918923 lead(h.timestamp) over(partition by h.task_id order by h.timestamp) - h.timestamp as elapsed
919924 from build
920925 join task using (build_id)
921926 join task_status_history h using (task_id)
922- where task.status = 'COMPLETED'
923- and (build.branch_name = 'master' or build.branch_name like 'REL_%%')
924- )
927+ where task.status = 'COMPLETED')
925928 select branch_name,
926929 task_name,
927930 status,
@@ -938,14 +941,15 @@ def refresh_build_status_statistics(conn):
938941 cursor .execute ("""delete from build_status_statistics""" )
939942 cursor .execute ("""insert into build_status_statistics
940943 (branch_name, status, avg_elapsed, stddev_elapsed, n)
941- with elapsed as (select build.branch_name as branch_name,
944+ with elapsed as (select case
945+ when build.branch_name like 'cf/%%' then 'cf/*'
946+ else branch_name
947+ end as branch_name,
942948 h.status,
943949 lead(received) over (partition by h.build_id order by received) - received as elapsed
944950 from build_status_history h
945951 join build using (build_id)
946- where build.status = 'COMPLETED'
947- and (build.branch_name = 'master' or build.branch_name like 'REL_%%')
948- )
952+ where build.status = 'COMPLETED')
949953 select branch_name,
950954 status,
951955 avg(elapsed),
0 commit comments