Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not put results_info in the db. #2071

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 8 additions & 18 deletions server/fishtest/rundb.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,6 @@ def update_aggregated_data(self):
run = self.get_run(run_id)
changed = False
with self.active_run_lock(run_id):
version = run.get("version", 0)
if version < RUN_VERSION:
print(
f"Warning: upgrading run {run_id} to version {RUN_VERSION}",
flush=True,
)
run["version"] = RUN_VERSION
changed = True
results = compute_results(run)
if results != run["results"]:
print(
Expand Down Expand Up @@ -876,7 +868,6 @@ 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
games_per_minute = 0.0
Expand Down Expand Up @@ -904,8 +895,14 @@ def aggregate_unfinished_runs(self, username=None):
eta = remaining_hours(run) / cores
pending_hours += eta
results = run["results"]
run["results_info"] = format_results(results, run)
return (runs, pending_hours, cores, nps, games_per_minute, machines_count)
return (
runs,
pending_hours,
cores,
nps,
games_per_minute,
machines_count,
)

def get_finished_runs(
self,
Expand Down Expand Up @@ -1542,12 +1539,6 @@ def stop_run(self, run_id):
self.set_inactive_run(run)

results = run["results"]
run["results_info"] = format_results(results, run)
# De-couple the styling of the run from its finished status
if run["results_info"]["style"] == "#44EB44":
run["is_green"] = True
elif run["results_info"]["style"] == "yellow":
run["is_yellow"] = True
try:
validate(runs_schema, run, "run")
except ValidationError as e:
Expand Down Expand Up @@ -1654,7 +1645,6 @@ def purge_run(self, run, p=0.001, res=7.0, iters=1):
if run["args"]["sprt"]["state"] != "":
revived = False

run["results_info"] = format_results(results, run)
if revived:
self.set_active_run(run)
else:
Expand Down
6 changes: 1 addition & 5 deletions server/fishtest/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ def flags_must_match(run):
# about non-validation of runs created with the prior
# schema.

RUN_VERSION = 3
RUN_VERSION = 4

runs_schema = intersect(
{
Expand All @@ -663,10 +663,6 @@ def flags_must_match(run):
"committed_games": uint,
"total_games": uint,
"results": results_schema,
"results_info?": {
"style": str,
"info": [str, ...],
},
"args": intersect(
{
"base_tag": str,
Expand Down
20 changes: 11 additions & 9 deletions server/fishtest/templates/elo_results.mak
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<%page args="run, show_gauge=False"/>

<%!
from fishtest.util import is_active_sprt_ltc
from fishtest.util import is_active_sprt_ltc, format_results

def results_pre_attrs(run):
def results_pre_attrs(results_info, run):
ret = ''
style = run['results_info'].get('style', '')
style = results_info.get('style', '')
if style:
ret = f'style="background-color: {style};"'

Expand All @@ -18,10 +18,12 @@

return ret
%>

<%
results_info = format_results(run)
%>
<%def name="list_info(run)">
<%
info = run['results_info']['info']
info = results_info['info']
l = len(info)
elo_ptnml_run = (
"sprt" not in run["args"]
Expand Down Expand Up @@ -68,23 +70,23 @@
% endif
</%def>

% if 'sprt' in run['args'] and 'Pending' not in run['results_info']['info'][0]:
% if 'sprt' in run['args'] and 'Pending' not in results_info['info'][0]:
<a href="/tests/live_elo/${str(run['_id'])}" style="color: inherit;">
% endif
% if show_gauge:
<div id="chart_div_${str(run['_id'])}" style="width:90px;float:left;"></div>
% if 'sprt' in run['args'] and 'Pending' not in run['results_info']['info'][0]:
% if 'sprt' in run['args'] and 'Pending' not in results_info['info'][0]:
<div style="margin-left:90px;padding: 30px 0;">
% else:
<div style="margin-left:90px;">
% endif
% endif
<pre ${results_pre_attrs(run)|n}>
<pre ${results_pre_attrs(results_info, run)|n}>
${list_info(run)}
</pre>
% if show_gauge:
</div>
% endif
% if 'sprt' in run['args'] and 'Pending' not in run['results_info']['info'][0]:
% if 'sprt' in run['args'] and 'Pending' not in results_info['info'][0]:
</a>
% endif
4 changes: 3 additions & 1 deletion server/fishtest/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ def format_bounds(elo_model, elo0, elo1):
)


def format_results(run_results, run):
def format_results(run):
run_results = run["results"]

result = {"style": "", "info": []}

# win/loss/draw count
Expand Down
2 changes: 0 additions & 2 deletions server/fishtest/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
extract_repo_from_link,
format_bounds,
format_date,
format_results,
get_chi2,
get_hash,
get_tc_ratio,
Expand Down Expand Up @@ -1489,7 +1488,6 @@ def tests_view(request):
raise HTTPNotFound()
follow = 1 if "follow" in request.params else 0
results = run["results"]
run["results_info"] = format_results(results, run)
run_args = [("id", str(run["_id"]), "")]
if run.get("rescheduled_from"):
run_args.append(("rescheduled_from", run["rescheduled_from"], ""))
Expand Down
1 change: 0 additions & 1 deletion server/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,6 @@ def test_auto_purge_runs(self):
run = self.rundb.get_run(run_id)
self.assertTrue(run["finished"])
self.assertTrue(all([not t["active"] for t in run["tasks"]]))
self.assertTrue("Total: {}".format(num_games) in run["results_info"]["info"][1])


if __name__ == "__main__":
Expand Down
Loading