@@ -85,9 +85,9 @@ def main():
85
85
history_for_n_day = args .days_window
86
86
build_type = args .build_type
87
87
branch = args .branch
88
-
89
- print (f'Getting hostory in window { history_for_n_day } days' )
90
-
88
+
89
+ print (f'Getting history in window { history_for_n_day } days' )
90
+
91
91
92
92
if "CI_YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS" not in os .environ :
93
93
print (
@@ -109,17 +109,17 @@ def main():
109
109
session = ydb .retry_operation_sync (
110
110
lambda : driver .table_client .session ().create ()
111
111
)
112
-
112
+
113
113
# settings, paths, consts
114
114
tc_settings = ydb .TableClientSettings ().with_native_date_in_result_sets (enabled = True )
115
115
table_client = ydb .TableClient (driver , tc_settings )
116
-
116
+
117
117
table_path = f'test_results/analytics/flaky_tests_window_{ history_for_n_day } _days'
118
- default_start_date = datetime .date (2024 , 9 , 1 )
119
-
118
+ default_start_date = datetime .date (2025 , 2 , 28 )
119
+
120
120
with ydb .SessionPool (driver ) as pool :
121
121
create_tables (pool , table_path )
122
-
122
+
123
123
# geting last date from history
124
124
last_date_query = f"""select max(date_window) as max_date_window from `{ table_path } `
125
125
where build_type = '{ build_type } ' and branch = '{ branch } '"""
@@ -132,16 +132,16 @@ def main():
132
132
results = results + result .result_set .rows
133
133
except StopIteration :
134
134
break
135
-
135
+
136
136
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 :
137
137
last_datetime = results [0 ].get (
138
138
'max_date_window' , default_start_date )
139
139
140
140
else :
141
141
last_datetime = default_start_date
142
-
142
+
143
143
last_date = last_datetime .strftime ('%Y-%m-%d' )
144
-
144
+
145
145
print (f'last hisotry date: { last_date } ' )
146
146
# getting history for dates >= last_date
147
147
@@ -178,7 +178,7 @@ def main():
178
178
max(run_timestamp) as last_run
179
179
from (
180
180
select * from (
181
-
181
+
182
182
select distinct
183
183
full_name,
184
184
suite_folder,
@@ -187,30 +187,30 @@ def main():
187
187
Date('{ date } ') as date_base,
188
188
'{ build_type } ' as build_type,
189
189
'{ branch } ' as branch
190
- from `test_results/analytics/testowners`
190
+ from `test_results/analytics/testowners`
191
+ where run_timestamp_last >= Date('{ date } ') - Interval('P30D')
191
192
) as test_and_date
192
193
left JOIN (
193
-
194
+
194
195
select
195
196
suite_folder || '/' || test_name as full_name,
196
197
run_timestamp,
197
198
status
198
199
from `test_results/test_runs_column`
199
200
where
200
201
run_timestamp <= Date('{ date } ') + Interval("P1D")
201
- and run_timestamp >= Date('{ date } ') - { history_for_n_day + 1 } *Interval("P1D")
202
-
202
+ and run_timestamp >= Date('{ date } ') { '' if history_for_n_day == 1 else f'-{ history_for_n_day } *Interval("P1D")' }
203
203
and job_name in (
204
204
'Nightly-run',
205
205
'Regression-run',
206
206
'Regression-whitelist-run',
207
- 'Postcommit_relwithdebinfo',
207
+ 'Postcommit_relwithdebinfo',
208
208
'Postcommit_asan'
209
- )
209
+ )
210
210
and build_type = '{ build_type } '
211
211
and branch = '{ branch } '
212
212
order by full_name,run_timestamp desc
213
-
213
+
214
214
) as hist
215
215
ON test_and_date.full_name=hist.full_name
216
216
)
0 commit comments