Skip to content

Commit 7f5f72a

Browse files
author
Pavel Kosov
committed
[LNT] Fix the global_status page
It seems the page `/global_status` did not work for years because of few bugs. This patch fixes this page. OS Laboratory. Huawei Russian Research Institute. Saint-Petersburg Reviewed By: thopre Differential Revision: https://reviews.llvm.org/D115700
1 parent 12c760f commit 7f5f72a

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

lnt/server/ui/views.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,8 +1501,8 @@ def v4_global_status():
15011501
yesterday = latest_date - datetime.timedelta(days=1)
15021502

15031503
# Get arguments.
1504-
revision = int(request.args.get('revision',
1505-
ts.Machine.DEFAULT_BASELINE_REVISION))
1504+
revision = request.args.get('revision',
1505+
str(ts.Machine.DEFAULT_BASELINE_REVISION))
15061506
field = fields.get(request.args.get('field', None), metric_fields[0])
15071507

15081508
# Get the list of all runs we might be interested in.
@@ -1539,8 +1539,8 @@ def get_machine_keys(m):
15391539
runs = recent_runs_by_machine[machine]
15401540

15411541
# Get the baseline run for this machine.
1542-
baseline = machine.get_closest_previously_reported_run(session,
1543-
revision)
1542+
baseline = machine.get_closest_previously_reported_run(
1543+
session, ts.Order(llvm_project_revision=revision))
15441544

15451545
# Choose the "best" run to report on. We want the most recent one with
15461546
# the most recent order.
@@ -1550,6 +1550,9 @@ def get_machine_keys(m):
15501550
reported_run_ids.append(baseline.id)
15511551
reported_run_ids.append(run.id)
15521552

1553+
if not machine_run_info:
1554+
abort(404, "No closest runs for revision '{}'".format(revision))
1555+
15531556
# Get the set all tests reported in the recent runs.
15541557
reported_tests = session.query(ts.Test.id, ts.Test.name).filter(
15551558
sqlalchemy.sql.exists('*', sqlalchemy.sql.and_(
@@ -1570,7 +1573,7 @@ def get_machine_keys(m):
15701573
# Compute comparison results for each machine.
15711574
row.extend((runinfo.get_run_comparison_result(
15721575
run, baseline, test_id, field,
1573-
ts.Sample.get_hash_of_binary_field),
1576+
ts.Sample.get_hash_of_binary_field()),
15741577
run.id)
15751578
for baseline, run in machine_run_info)
15761579

@@ -1582,7 +1585,7 @@ def get_machine_keys(m):
15821585
test_table.append(row)
15831586

15841587
# Order the table by worst regression.
1585-
test_table.sort(key=lambda row: 0 if row[1] is None else row[1], reverse=True)
1588+
test_table.sort(key=lambda row: row[1], reverse=True)
15861589

15871590
return render_template("v4_global_status.html",
15881591
tests=test_table,
@@ -1805,13 +1808,6 @@ def health():
18051808

18061809
@v4_route("/search")
18071810
def v4_search():
1808-
def _isint(i):
1809-
try:
1810-
int(i)
1811-
return True
1812-
except Exception:
1813-
return False
1814-
18151811
session = request.session
18161812
ts = request.get_testsuite()
18171813
query = request.args.get('q')

0 commit comments

Comments
 (0)