Skip to content

Commit d5b523d

Browse files
authored
Added separation skips/not_runed for flaky analitycs (#8551)
1 parent 55c87c9 commit d5b523d

File tree

1 file changed

+45
-23
lines changed

1 file changed

+45
-23
lines changed

.github/scripts/analytics/flaky_tests_history_n_runs.py

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def callee(session):
4343
`mute_count` Uint64,
4444
`fail_count` Uint64,
4545
`skip_count` Uint64,
46-
PRIMARY KEY (`test_name`, `suite_folder`, `full_name`,date_window,runs_window,build_type,branch,owners)
46+
PRIMARY KEY (`test_name`, `suite_folder`, `full_name`,date_window,runs_window,build_type,branch)
4747
)
4848
PARTITION BY HASH(`full_name`,build_type,branch)
4949
WITH (STORE = COLUMN)
@@ -134,15 +134,15 @@ def main():
134134
except StopIteration:
135135
break
136136

137-
if results[0] and results[0].get( 'max_date_window', default_start_date) is not None:
138-
last_date = results[0].get(
139-
'max_date_window', default_start_date).strftime('%Y-%m-%d')
137+
if results[0] and results[0].get( 'max_date_window', default_start_date) is not None and results[0].get( 'max_date_window', default_start_date) > default_start_date:
140138
last_datetime = results[0].get(
141139
'max_date_window', default_start_date)
140+
142141
else:
143-
last_date = default_start_date.strftime('%Y-%m-%d')
144142
last_datetime = default_start_date
145-
143+
144+
last_date = last_datetime.strftime('%Y-%m-%d')
145+
146146
print(f'last hisotry date: {last_date}')
147147
today = datetime.date.today()
148148
date_list = [today - datetime.timedelta(days=x) for x in range((today - last_datetime).days+1)]
@@ -154,7 +154,7 @@ def main():
154154
build_type,
155155
branch,
156156
history_list,
157-
dist_hist,
157+
if(dist_hist = '','no_runs',dist_hist) as dist_hist,
158158
suite_folder,
159159
test_name,
160160
owners,
@@ -167,7 +167,7 @@ def main():
167167
build_type,
168168
branch,
169169
AGG_LIST(status) as history_list ,
170-
String::JoinFromList( AGG_LIST_DISTINCT(status) ,',') as dist_hist,
170+
String::JoinFromList( ListSort(AGG_LIST_DISTINCT(status)) ,',') as dist_hist,
171171
suite_folder,
172172
test_name,
173173
owners,
@@ -187,21 +187,43 @@ def main():
187187
) as test_and_date
188188
left JOIN (
189189
select * from (
190-
select
191-
suite_folder || '/' || test_name as full_name,
192-
run_timestamp,
193-
status ,
194-
ROW_NUMBER() OVER (PARTITION BY suite_folder,test_name ORDER BY run_timestamp DESC) AS run_number
195-
from `test_results/test_runs_column`
196-
where
197-
run_timestamp <= Date('{date}') + Interval("P1D")
198-
and run_timestamp >= Date('{date}') -13*Interval("P1D")
199-
and job_name in ('Postcommit_relwithdebinfo','Postcommit_asan')
200-
and build_type = '{build_type}'
201-
and status != 'skipped'
202-
and branch = '{branch}'
203-
)
204-
where run_number <= {history_for_n_runs}
190+
select * from (
191+
select * from (
192+
select
193+
suite_folder || '/' || test_name as full_name,
194+
run_timestamp,
195+
status ,
196+
ROW_NUMBER() OVER (PARTITION BY suite_folder,test_name ORDER BY run_timestamp DESC) AS run_number
197+
from `test_results/test_runs_column`
198+
where
199+
run_timestamp <= Date('{date}') + Interval("P1D")
200+
and run_timestamp >= Date('{date}') -13*Interval("P1D")
201+
and job_name in ('Postcommit_relwithdebinfo','Postcommit_asan')
202+
and build_type = '{build_type}'
203+
and status != 'skipped'
204+
and branch = '{branch}'
205+
)
206+
where run_number <= {history_for_n_runs}
207+
)
208+
Union all
209+
select * from (
210+
select
211+
suite_folder || '/' || test_name as full_name,
212+
run_timestamp,
213+
status ,
214+
ROW_NUMBER() OVER (PARTITION BY suite_folder,test_name ORDER BY run_timestamp DESC) AS run_number
215+
from `test_results/test_runs_column`
216+
where
217+
run_timestamp <= Date('{date}') + Interval("P1D")
218+
and run_timestamp >= Date('{date}') -13*Interval("P1D")
219+
and job_name in ('Postcommit_relwithdebinfo','Postcommit_asan')
220+
and build_type = '{build_type}'
221+
and status = 'skipped'
222+
and branch = '{branch}'
223+
)
224+
where run_number <= {history_for_n_runs}
225+
)
226+
order by full_name,run_timestamp
205227
) as hist
206228
ON test_and_date.full_name=hist.full_name
207229
)

0 commit comments

Comments
 (0)