Skip to content

Commit 3bb8ff8

Browse files
Pavel KosovThomas Preud'homme
authored andcommitted
[LNT] Fixed fieldchanges grouping to a regression
Note active_indicators is not a list of regression indicators. It is a list of fieldchanges actually. After that fix all new fieldchanges will be grouped mostly in the same regression as expected. It prevents creating of thousand new regressions and ageing them out immediately to keep regressions count under 50. Reviewed By: thopre Differential Revision: https://reviews.llvm.org/D109216
1 parent b1232c5 commit 3bb8ff8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lnt/server/db/fieldchange.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def regenerate_fieldchanges_for_run(session, ts, run_id):
125125
.filter(ts.FieldChange.field_id.in_(field_ids))
126126
.all())
127127

128-
active_indicators = session.query(ts.FieldChange) \
128+
active_changes = session.query(ts.FieldChange) \
129129
.join(ts.RegressionIndicator) \
130130
.join(ts.Regression) \
131131
.filter(or_(ts.Regression.state == RegressionState.DETECTED,
@@ -175,12 +175,12 @@ def regenerate_fieldchanges_for_run(session, ts, run_id):
175175
session.flush()
176176
try:
177177
found, new_reg = identify_related_changes(session, ts,
178-
f, active_indicators)
178+
f, active_changes)
179179
except ObjectDeletedError:
180180
# This can happen from time to time.
181181
# So, lets retry once.
182182
found, new_reg = identify_related_changes(session, ts,
183-
f, active_indicators)
183+
f, active_changes)
184184

185185
if found:
186186
logger.info("Found field change: {}".format(
@@ -225,7 +225,7 @@ def percent_similar(a, b):
225225

226226

227227
@timed
228-
def identify_related_changes(session, ts, fc, active_indicators):
228+
def identify_related_changes(session, ts, fc, active_changes):
229229
# type: (Session, TestSuiteDB, TestSuiteDB.FieldChange, List) -> Tuple[bool, List]
230230
"""Can we find a home for this change in some existing regression? If a
231231
match is found add a regression indicator adding this change to that
@@ -236,7 +236,7 @@ def identify_related_changes(session, ts, fc, active_indicators):
236236
237237
"""
238238

239-
for change in active_indicators:
239+
for change in active_changes:
240240
if is_overlaping(change, fc):
241241
confidence = 0.0
242242

@@ -260,13 +260,13 @@ def identify_related_changes(session, ts, fc, active_indicators):
260260
ri = ts.RegressionIndicator(regression, fc)
261261
session.add(ri)
262262
session.flush()
263-
active_indicators.append(ri)
263+
active_changes.append(fc)
264264
# Update the default title if needed.
265265
rebuild_title(session, ts, regression)
266266
logger.info("Updated title of Regression({}) to \"{}\"".format(regression.id, regression.title))
267267
return True, regression
268268

269-
new_reg, new_indicators = new_regression(session, ts, [fc.id])
269+
new_reg, new_indicators = new_regression(session, ts, [fc])
270270
logger.info("Could not find a partner, creating new Regression for change: {}".format(new_reg.title))
271-
active_indicators.extend(new_indicators)
271+
active_changes.append(fc)
272272
return False, new_reg

0 commit comments

Comments
 (0)