From 9d5bcbc59c5c1efd2ebdc7802bf87a39ab2558a5 Mon Sep 17 00:00:00 2001 From: Dubslow Date: Tue, 14 Feb 2023 17:14:19 -0600 Subject: [PATCH] Add tooltip with itp and cores/itp to homepage This allows more advanced users to keep a closer eye on the server without confusing new viewers (take 2, cleaner syntax, more consistent style with : instead of =) --- server/fishtest/rundb.py | 10 +++++----- server/fishtest/templates/tests.mak | 2 +- server/fishtest/views.py | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/server/fishtest/rundb.py b/server/fishtest/rundb.py index 20d4da77c..20ba1ae38 100644 --- a/server/fishtest/rundb.py +++ b/server/fishtest/rundb.py @@ -495,7 +495,7 @@ def aggregate_unfinished_runs(self, username=None): runs["pending"].sort( key=lambda run: ( run["args"]["priority"], - run["args"]["itp"] if "itp" in run["args"] else 100, + run["args"].get("itp", 100), ) ) runs["active"].sort( @@ -511,8 +511,7 @@ def aggregate_unfinished_runs(self, username=None): ) # Calculate but don't save results_info on runs using info on current machines - cores = 0 - nps = 0 + cores = itp = nps = 0 for m in self.get_machines(): concurrency = int(m["concurrency"]) cores += concurrency @@ -522,18 +521,19 @@ def aggregate_unfinished_runs(self, username=None): if cores > 0: eta = remaining_hours(run) / cores pending_hours += eta + itp += run["args"].get("itp", 100) results = self.get_results(run, False) run["results_info"] = format_results(results, run) if "Pending..." in run["results_info"]["info"]: if cores > 0: - run["results_info"]["info"][0] += " ({:.1f} hrs)".format(eta) + run["results_info"]["info"][0] += f" ({eta:.1f} hrs)" if "sprt" in run["args"]: sprt = run["args"]["sprt"] elo_model = sprt.get("elo_model", "BayesElo") run["results_info"]["info"].append( format_bounds(elo_model, sprt["elo0"], sprt["elo1"]) ) - return (runs, pending_hours, cores, nps) + return (runs, pending_hours, cores, itp, nps) def get_finished_runs( self, diff --git a/server/fishtest/templates/tests.mak b/server/fishtest/templates/tests.mak index 36fc857be..475a3ed0c 100644 --- a/server/fishtest/templates/tests.mak +++ b/server/fishtest/templates/tests.mak @@ -15,7 +15,7 @@
Cores
-
+

${cores}

diff --git a/server/fishtest/views.py b/server/fishtest/views.py index a69e82adc..da90219d6 100644 --- a/server/fishtest/views.py +++ b/server/fishtest/views.py @@ -1392,13 +1392,14 @@ def homepage_results(request): ) ) # Get updated results for unfinished runs + finished runs - (runs, pending_hours, cores, nps) = request.rundb.aggregate_unfinished_runs() + (runs, pending_hours, cores, itp, nps) = request.rundb.aggregate_unfinished_runs() return { **get_paginated_finished_runs(request), "runs": runs, "machines": machines, - "pending_hours": "{:.1f}".format(pending_hours), + "pending_hours": f"{pending_hours:.1f}", "cores": cores, + "itp": itp, "nps": nps, "games_per_minute": int(games_per_minute), }