[LNT] r318359 - Optimize regression evolution by prefiltering by machine_id
Chris Matthews via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 15 16:57:39 PST 2017
Author: cmatthews
Date: Wed Nov 15 16:57:39 2017
New Revision: 318359
URL: http://llvm.org/viewvc/llvm-project?rev=318359&view=rev
Log:
Optimize regression evolution by prefiltering by machine_id
Regression evolution is pretty slow. To speed it up, cut down the
comparisons it needs to make. As a first attempt, only compare
regressions that have a machine that overlaps with the run that is
currently being submitted.
Modified:
lnt/trunk/lnt/server/db/fieldchange.py
lnt/trunk/lnt/server/db/rules/rule_update_fixed_regressions.py
lnt/trunk/tests/server/ui/change_processing.py
Modified: lnt/trunk/lnt/server/db/fieldchange.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/fieldchange.py?rev=318359&r1=318358&r2=318359&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/fieldchange.py (original)
+++ lnt/trunk/lnt/server/db/fieldchange.py Wed Nov 15 16:57:39 2017
@@ -156,7 +156,7 @@ def regenerate_fieldchanges_for_run(sess
session.commit()
regressions = session.query(ts.Regression).all()[::-1]
- rules.post_submission_hooks(session, ts, regressions)
+ rules.post_submission_hooks(session, ts, run_id)
def is_overlaping(fc1, fc2):
Modified: lnt/trunk/lnt/server/db/rules/rule_update_fixed_regressions.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/rules/rule_update_fixed_regressions.py?rev=318359&r1=318358&r2=318359&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/rules/rule_update_fixed_regressions.py (original)
+++ lnt/trunk/lnt/server/db/rules/rule_update_fixed_regressions.py Wed Nov 15 16:57:39 2017
@@ -4,8 +4,8 @@ Staged or Active + fixed -> Verify
"""
from lnt.server.db.regression import RegressionState
from lnt.server.db.regression import get_cr_for_field_change, get_ris
-from lnt.util import logger
from lnt.testing.util.commands import timed
+from lnt.util import logger
def _fixed_rind(session, ts, rind):
@@ -29,6 +29,22 @@ def is_fixed(session, ts, regression):
return all(fixes)
+def impacts(session, ts, run_id, regression):
+ """Does this run have a chance of impacting this regression?
+
+ This is just to prevent doing a full comparison, so we don't have
+ to be toally accurate. For now, compare machines."""
+ machine_id = session.query(ts.Run.machine_id).filter(ts.Run.id == run_id).scalar()
+
+ regression_machines = [x[0] for x in session.query(ts.FieldChange.machine_id)
+ .join(ts.RegressionIndicator)
+ .filter(ts.RegressionIndicator.regression_id == regression.id)
+ .all()]
+
+ regression_machines_set = set(regression_machines)
+ return machine_id in regression_machines_set
+
+
@timed
def regression_evolution(session, ts, run_id):
"""Analyse regressions. If they have changes, process them.
@@ -50,21 +66,21 @@ def regression_evolution(session, ts, ru
active = [r for r in regressions if r.state == RegressionState.ACTIVE]
for regression in detects:
- if is_fixed(session, ts, regression):
+ if impacts(session, ts, run_id, regression) and is_fixed(session, ts, regression):
logger.info("Detected fixed regression" + str(regression))
regression.state = RegressionState.IGNORED
regression.title = regression.title + " [Detected Fixed]"
changed += 1
for regression in staged:
- if is_fixed(session, ts, regression):
+ if impacts(session, ts, run_id, regression) and is_fixed(session, ts, regression):
logger.info("Staged fixed regression" + str(regression))
regression.state = RegressionState.DETECTED_FIXED
regression.title = regression.title + " [Detected Fixed]"
changed += 1
for regression in active:
- if is_fixed(session, ts, regression):
+ if impacts(session, ts, run_id, regression) and is_fixed(session, ts, regression):
logger.info("Active fixed regression" + str(regression))
regression.state = RegressionState.DETECTED_FIXED
regression.title = regression.title + " [Detected Fixed]"
Modified: lnt/trunk/tests/server/ui/change_processing.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/ui/change_processing.py?rev=318359&r1=318358&r2=318359&view=diff
==============================================================================
--- lnt/trunk/tests/server/ui/change_processing.py (original)
+++ lnt/trunk/tests/server/ui/change_processing.py Wed Nov 15 16:57:39 2017
@@ -193,7 +193,7 @@ class ChangeProcessingTests(unittest.Tes
session = self.session
ts_db = self.ts_db
rule_update_fixed_regressions.regression_evolution(
- session, ts_db, self.regressions)
+ session, ts_db, self.run.id)
def test_fc_deletion(self):
session = self.session
More information about the llvm-commits
mailing list