[PATCH] D115700: [LNT] Fix the global_status page

Pavel Kosov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 13 22:47:31 PST 2021


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

It seems the page `/global_status` did not work for years because of few bugs.
This patch fixes this page.


Repository:
  rLNT LNT

https://reviews.llvm.org/D115700

Files:
  lnt/server/ui/views.py


Index: lnt/server/ui/views.py
===================================================================
--- lnt/server/ui/views.py
+++ lnt/server/ui/views.py
@@ -1501,8 +1501,8 @@
     yesterday = latest_date - datetime.timedelta(days=1)
 
     # Get arguments.
-    revision = int(request.args.get('revision',
-                                    ts.Machine.DEFAULT_BASELINE_REVISION))
+    revision = request.args.get('revision',
+                                str(ts.Machine.DEFAULT_BASELINE_REVISION))
     field = fields.get(request.args.get('field', None), metric_fields[0])
 
     # Get the list of all runs we might be interested in.
@@ -1540,7 +1540,7 @@
 
         # Get the baseline run for this machine.
         baseline = machine.get_closest_previously_reported_run(session,
-                                                               revision)
+                     ts.Order(llvm_project_revision=revision))
 
         # Choose the "best" run to report on. We want the most recent one with
         # the most recent order.
@@ -1550,6 +1550,9 @@
             reported_run_ids.append(baseline.id)
         reported_run_ids.append(run.id)
 
+    if not machine_run_info:
+        abort(404, "No closest runs for revision '{}'".format(revision))
+
     # Get the set all tests reported in the recent runs.
     reported_tests = session.query(ts.Test.id, ts.Test.name).filter(
         sqlalchemy.sql.exists('*', sqlalchemy.sql.and_(
@@ -1570,7 +1573,7 @@
         # Compute comparison results for each machine.
         row.extend((runinfo.get_run_comparison_result(
                         run, baseline, test_id, field,
-                        ts.Sample.get_hash_of_binary_field),
+                        ts.Sample.get_hash_of_binary_field()),
                     run.id)
                    for baseline, run in machine_run_info)
 
@@ -1582,7 +1585,7 @@
         test_table.append(row)
 
     # Order the table by worst regression.
-    test_table.sort(key=lambda row: 0 if row[1] is None else row[1], reverse=True)
+    test_table.sort(key=lambda row: row[1], reverse=True)
 
     return render_template("v4_global_status.html",
                            tests=test_table,
@@ -1805,13 +1808,6 @@
 
 @v4_route("/search")
 def v4_search():
-    def _isint(i):
-        try:
-            int(i)
-            return True
-        except Exception:
-            return False
-
     session = request.session
     ts = request.get_testsuite()
     query = request.args.get('q')


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115700.394144.patch
Type: text/x-patch
Size: 2494 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211214/46e7f00e/attachment.bin>


More information about the llvm-commits mailing list