[llvm-commits] [LNT] r169643 - in /lnt/trunk/lnt/server: db/fieldchange.py db/testsuitedb.py reporting/analysis.py
Michael Gottesman
mgottesman at apple.com
Fri Dec 7 14:04:58 PST 2012
Author: mgottesman
Date: Fri Dec 7 16:04:58 2012
New Revision: 169643
URL: http://llvm.org/viewvc/llvm-project?rev=169643&view=rev
Log:
[fieldchange] Added lnt.server.db.fieldchange for computation of FieldChange objects and wired it up to testsuitedb.py to insert FieldChange objects into the database.
Added:
lnt/trunk/lnt/server/db/fieldchange.py
Modified:
lnt/trunk/lnt/server/db/testsuitedb.py
lnt/trunk/lnt/server/reporting/analysis.py
Added: lnt/trunk/lnt/server/db/fieldchange.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/fieldchange.py?rev=169643&view=auto
==============================================================================
--- lnt/trunk/lnt/server/db/fieldchange.py (added)
+++ lnt/trunk/lnt/server/db/fieldchange.py Fri Dec 7 16:04:58 2012
@@ -0,0 +1,54 @@
+
+import sqlalchemy.sql
+
+import lnt.server.reporting.analysis
+
+def regenerate_fieldchanges_for_run(ts, run):
+ """Regenerate the set of FieldChange objects for the given run.
+ """
+
+ # Allow for potentially a few different runs, previous_runs, next_runs
+ # all with the same order_id which we will aggregate together to make
+ # our comparison result.
+ runs = ts.query(ts.Run).filter(ts.Run.order_id == run.order_id).all()
+ previous_runs = ts.get_previous_runs_on_machine(run, 1)
+ next_runs = ts.get_next_runs_on_machine(run, 1)
+
+ # Find our start/end order.
+ if previous_runs != []:
+ start_order = previous_runs[0].order
+ else:
+ start_order = run.order
+ if next_runs != []:
+ end_order = next_runs[-1].order
+ else:
+ end_order = run.order
+
+ # Load our run data for the creation of the new fieldchanges.
+ runs_to_load = [r.id for r in (runs + previous_runs + next_runs)]
+ runinfo = lnt.server.reporting.analysis.RunInfo(ts, runs_to_load)
+
+ for field in list(ts.sample_fields):
+ for test_id in runinfo.get_test_ids():
+ result = runinfo.get_comparison_result(runs, previous_runs,
+ test_id, field)
+ if result.is_result_interesting():
+ f = ts.FieldChange(start_order=start_order,
+ end_order=run.order,
+ test=None,
+ machine=run.machine,
+ field=field)
+ f.test_id = test_id
+ ts.add(f)
+
+ result = runinfo.get_comparison_result(runs, next_runs,
+ test_id, field)
+ if result.is_result_interesting():
+ f = ts.FieldChange(start_order=run.order,
+ end_order=end_order,
+ test=None,
+ machine=run.machine,
+ field=field)
+ f.test_id = test_id
+ ts.add(f)
+
Modified: lnt/trunk/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/testsuitedb.py?rev=169643&r1=169642&r2=169643&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/testsuitedb.py (original)
+++ lnt/trunk/lnt/server/db/testsuitedb.py Fri Dec 7 16:04:58 2012
@@ -12,6 +12,7 @@
from sqlalchemy import *
import testsuite
+import lnt.server.db.fieldchange
class TestSuiteDB(object):
"""
@@ -686,6 +687,8 @@
sample.set_field(sample_field, value)
+ lnt.server.db.fieldchange.regenerate_fieldchanges_for_run(self, run)
+
def importDataFromDict(self, data, config=None):
"""
importDataFromDict(data) -> Run, bool
Modified: lnt/trunk/lnt/server/reporting/analysis.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/reporting/analysis.py?rev=169643&r1=169642&r2=169643&view=diff
==============================================================================
--- lnt/trunk/lnt/server/reporting/analysis.py (original)
+++ lnt/trunk/lnt/server/reporting/analysis.py Fri Dec 7 16:04:58 2012
@@ -132,6 +132,9 @@
self._load_samples_for_runs(runs_to_load)
+ def get_test_ids(self):
+ return [key[1] for key in self.sample_map.keys()]
+
def get_run_comparison_result(self, run, compare_to, test_id, field,
comparison_window=[]):
if compare_to is not None:
More information about the llvm-commits
mailing list