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

Fix LTC page excluding SMP LTC tests #1572

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 8 additions & 7 deletions server/fishtest/rundb.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
get_chi2,
get_hash,
get_tc_ratio,
is_ltc,
post_in_fishcooking_results,
remaining_hours,
update_residuals,
Expand Down Expand Up @@ -94,7 +95,6 @@ def __init__(self, db_name="fishtest_new"):
self.task_runs = []

self.task_duration = 900 # 15 minutes
self.ltc_lower_bound = 40 # Beware: this is used as a filter in an index!
self.pt_info = {
"pt_version": "SF_15",
"pt_branch": "e6e324eb28fd49c1fc44b3b65784f85a773ec61c",
Expand Down Expand Up @@ -548,7 +548,7 @@ def get_finished_runs(
if username:
q["args.username"] = username
if ltc_only:
q["tc_base"] = {"$gte": self.ltc_lower_bound}
q["tc_base"] = {"$gte": 20} # String comparison, SMP LTC is 20 th 8
if success_only:
q["is_green"] = True
if yellow_only:
Expand All @@ -558,11 +558,12 @@ def get_finished_runs(
q, skip=skip, limit=limit, sort=[("last_updated", DESCENDING)]
)

count = self.runs.count_documents(q)

# Don't show runs that were deleted
runs_list = [run for run in c if not run.get("deleted")]
return [runs_list, count]
if ltc_only:
predicate = lambda run: not run.get("deleted") and is_ltc(run)
else:
predicate = lambda run: not run.get("deleted")
runs_list = list(filter(predicate, c))
return runs_list, len(runs_list)

def get_results(self, run, save_run=True):
if not run["results_stale"]:
Expand Down
4 changes: 2 additions & 2 deletions server/fishtest/templates/run_table.mak
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
% endif

<%
from fishtest.util import get_cookie, is_active_sprt_ltc
from fishtest.util import get_cookie, is_ltc
if toggle:
cookie_name = toggle+"_state"
%>
Expand Down Expand Up @@ -109,7 +109,7 @@
</td>

<td style="width: 13%;" class="run-live">
<span class="${'rounded ltc-highlight me-1' if is_active_sprt_ltc(run) else 'me-1'}">
<span class="${'rounded ltc-highlight me-1' if not run["finished"] and "sprt" in run["args"] and is_ltc(run) else 'me-1'}">
% if 'sprt' in run['args']:
<a href="/tests/live_elo/${str(run['_id'])}" target="_blank">sprt</a>
% else:
Expand Down
9 changes: 3 additions & 6 deletions server/fishtest/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,9 @@ def get_tc_ratio(tc, threads=1, base="10+0.1"):
return threads * estimate_game_duration(tc) / estimate_game_duration(base)


def is_active_sprt_ltc(run):
return (
not run["finished"]
and "sprt" in run["args"]
and get_tc_ratio(run["args"]["tc"], run["args"]["threads"]) > 4
) # SMP-STC ratio is 4
def is_ltc(run):
# SMP-STC ratio is 4
return get_tc_ratio(run["args"]["tc"], run["args"].get("threads", 1)) > 4


def remaining_hours(run):
Expand Down
3 changes: 2 additions & 1 deletion server/fishtest/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
format_results,
get_chi2,
get_hash,
is_ltc,
password_strength,
update_residuals,
)
Expand Down Expand Up @@ -885,7 +886,7 @@ def new_run_message(request, run):
if run["args"]["new_tc"] != run["args"]["tc"]
else ""
)
ret += "(LTC)" if run["tc_base"] >= request.rundb.ltc_lower_bound else ""
ret += "(LTC)" if is_ltc(run) else ""
ret += f" Book:{run['args']['book']}"
ret += f" Threads:{run['args']['threads']}"
ret += "(SMP)" if run["args"]["threads"] > 1 else ""
Expand Down
2 changes: 1 addition & 1 deletion server/utils/create_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_runs_indexes():
("tc_base", DESCENDING),
],
name="finished_ltc_runs",
partialFilterExpression={"finished": True, "tc_base": {"$gte": 40}},
partialFilterExpression={"finished": True, "tc_base": {"$gte": 20}}, # SMP LTC is 20 th 8
)
db["runs"].create_index(
[("args.username", DESCENDING), ("last_updated", DESCENDING)], name="user_runs"
Expand Down