[PATCH] D109216: [LNT] Fixed fieldchanges grouping to a regression

Pavel Kosov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 3 02:31:55 PDT 2021


kpdev42 created this revision.
kpdev42 added reviewers: cmatthews, thopre, danilaml.
Herald added a subscriber: dkolesnichenko.
kpdev42 requested review of this revision.

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.


Repository:
  rLNT LNT

https://reviews.llvm.org/D109216

Files:
  lnt/server/db/fieldchange.py


Index: lnt/server/db/fieldchange.py
===================================================================
--- lnt/server/db/fieldchange.py
+++ lnt/server/db/fieldchange.py
@@ -125,7 +125,7 @@
                               .filter(ts.FieldChange.field_id.in_(field_ids))
                               .all())
 
-    active_indicators = session.query(ts.FieldChange) \
+    active_changes = session.query(ts.FieldChange) \
         .join(ts.RegressionIndicator) \
         .join(ts.Regression) \
         .filter(or_(ts.Regression.state == RegressionState.DETECTED,
@@ -175,12 +175,12 @@
                 session.flush()
                 try:
                     found, new_reg = identify_related_changes(session, ts,
-                                                              f, active_indicators)
+                                                              f, active_changes)
                 except ObjectDeletedError:
                     # This can happen from time to time.
                     # So, lets retry once.
                     found, new_reg = identify_related_changes(session, ts,
-                                                              f, active_indicators)
+                                                              f, active_changes)
 
                 if found:
                     logger.info("Found field change: {}".format(
@@ -225,7 +225,7 @@
 
 
 @timed
-def identify_related_changes(session, ts, fc, active_indicators):
+def identify_related_changes(session, ts, fc, active_changes):
     # type: (Session, TestSuiteDB, TestSuiteDB.FieldChange, List) -> Tuple[bool, List]
     """Can we find a home for this change in some existing regression? If a
     match is found add a regression indicator adding this change to that
@@ -236,7 +236,7 @@
 
     """
 
-    for change in active_indicators:
+    for change in active_changes:
         if is_overlaping(change, fc):
             confidence = 0.0
 
@@ -260,13 +260,13 @@
                 ri = ts.RegressionIndicator(regression, fc)
                 session.add(ri)
                 session.flush()
-                active_indicators.append(ri)
+                active_changes.append(fc)
                 # Update the default title if needed.
                 rebuild_title(session, ts, regression)
                 logger.info("Updated title of Regression({}) to \"{}\"".format(regression.id, regression.title))
                 return True, regression
 
-    new_reg, new_indicators = new_regression(session, ts, [fc.id])
+    new_reg, new_indicators = new_regression(session, ts, [fc])
     logger.info("Could not find a partner, creating new Regression for change: {}".format(new_reg.title))
-    active_indicators.extend(new_indicators)
+    active_changes.append(fc)
     return False, new_reg


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109216.370499.patch
Type: text/x-patch
Size: 2797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210903/3d15c8c6/attachment.bin>


More information about the llvm-commits mailing list