@@ -34,6 +34,9 @@ def callee(session):
3434 `build_type` Utf8 NOT NULL,
3535 `branch` Utf8 NOT NULL,
3636 `runs_window` Uint64 NOT NULL,
37+ `first_run` Timestamp,
38+ `last_run` Timestamp ,
39+ `owners` Utf8 NOT NULL,
3740 `history` String,
3841 `history_class` String,
3942 `pass_count` Uint64,
@@ -59,6 +62,9 @@ def bulk_upsert(table_client, table_path, rows):
5962 .add_column ("branch" , ydb .OptionalType (ydb .PrimitiveType .Utf8 ))
6063 .add_column ("full_name" , ydb .OptionalType (ydb .PrimitiveType .Utf8 ))
6164 .add_column ("date_window" , ydb .OptionalType (ydb .PrimitiveType .Date ))
65+ .add_column ("first_run" , ydb .OptionalType (ydb .PrimitiveType .Timestamp ))
66+ .add_column ("last_run" , ydb .OptionalType (ydb .PrimitiveType .Timestamp ))
67+ .add_column ("owners" , ydb .OptionalType (ydb .PrimitiveType .Utf8 ))
6268 .add_column ("runs_window" , ydb .OptionalType (ydb .PrimitiveType .Uint64 ))
6369 .add_column ("history" , ydb .OptionalType (ydb .PrimitiveType .String ))
6470 .add_column ("history_class" , ydb .OptionalType (ydb .PrimitiveType .String ))
@@ -128,15 +134,15 @@ def main():
128134 except StopIteration :
129135 break
130136
131- if results [0 ] and results [0 ].get ( 'max_date_window' , default_start_date ) is not None :
132- last_date = results [0 ].get (
133- '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 :
134138 last_datetime = results [0 ].get (
135139 'max_date_window' , default_start_date )
140+
136141 else :
137- last_date = default_start_date .strftime ('%Y-%m-%d' )
138142 last_datetime = default_start_date
139-
143+
144+ last_date = last_datetime .strftime ('%Y-%m-%d' )
145+
140146 print (f'last hisotry date: { last_date } ' )
141147 today = datetime .date .today ()
142148 date_list = [today - datetime .timedelta (days = x ) for x in range ((today - last_datetime ).days + 1 )]
@@ -148,48 +154,80 @@ def main():
148154 build_type,
149155 branch,
150156 history_list,
151- dist_hist,
157+ if(dist_hist = '','no_runs',dist_hist) as dist_hist,
152158 suite_folder,
153- test_name
159+ test_name,
160+ owners,
161+ first_run,
162+ last_run
154163 from (
155164 select
156165 full_name,
157166 date_base,
158167 build_type,
159168 branch,
160169 AGG_LIST(status) as history_list ,
161- String::JoinFromList( AGG_LIST_DISTINCT(status) ,',') as dist_hist,
170+ String::JoinFromList( ListSort( AGG_LIST_DISTINCT(status) ) ,',') as dist_hist,
162171 suite_folder,
163- test_name
172+ test_name,
173+ owners,
174+ min(run_timestamp) as first_run,
175+ max(run_timestamp) as last_run
164176 from (
165177 select * from (
166- select t1.test_name, t1.suite_folder, t1.full_name,
167- Date('{ date } ') as date_base,
168- '{ build_type } ' as build_type,
169- '{ branch } ' as branch
178+ select
179+ t1.suite_folder,
180+ t1.test_name,
181+ t1.full_name,
182+ t1.owners,
183+ Date('{ date } ') as date_base,
184+ '{ build_type } ' as build_type,
185+ '{ branch } ' as branch
170186 from `test_results/analytics/testowners` as t1
171187 ) as test_and_date
172188 left JOIN (
173189 select * from (
174- select
175- suite_folder || '/' || test_name as full_name,
176- run_timestamp,
177- status ,
178- ROW_NUMBER() OVER (PARTITION BY test_name ORDER BY run_timestamp DESC) AS run_number
179- from `test_results/test_runs_column`
180- where
181- run_timestamp <= Date('{ date } ')
182- and run_timestamp >= Date('{ date } ') -14*Interval("P1D")
183- and job_name in ('Postcommit_relwithdebinfo','Postcommit_asan')
184- and build_type = '{ build_type } '
185- and status != 'skipped'
186- and branch = '{ branch } '
187- )
188- 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
189227 ) as hist
190228 ON test_and_date.full_name=hist.full_name
191229 )
192- GROUP BY full_name,suite_folder,test_name,date_base,build_type,branch
230+ GROUP BY full_name,suite_folder,test_name,date_base,build_type,branch,owners
193231
194232 )
195233 """
@@ -217,6 +255,9 @@ def main():
217255 prepared_for_update_rows .append ({
218256 'suite_folder' : row ['suite_folder' ],
219257 'test_name' : row ['test_name' ],
258+ 'first_run' : row ['first_run' ],
259+ 'last_run' : row ['last_run' ],
260+ 'owners' : row ['owners' ],
220261 'full_name' : row ['full_name' ],
221262 'date_window' : row ['date_base' ],
222263 'build_type' : row ['build_type' ],
0 commit comments