From f06eb7bce5149e442fcf10cebc502ca28af02e62 Mon Sep 17 00:00:00 2001 From: Joost VandeVondele Date: Wed, 12 Jul 2023 16:26:59 +0200 Subject: [PATCH] Reduce ITP with number of active tests per user given some excessive number of active tests by some users, this patch reduces itp based on the number of active tests. The formula used is `itp *= 36.0 / (36.0 + count * count)` This reduces slowly the itp for a number of tests smaller than 6, and rapidly afterwards. For 3 active tests, the itp is 80%, for 6 active tests, the itp is 50%, for 15 active tests it is down to 13%. For a maximum share of fishtest... have 6 tests in queue. --- server/fishtest/rundb.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/server/fishtest/rundb.py b/server/fishtest/rundb.py index c6c2dda2e..f0c8f763f 100644 --- a/server/fishtest/rundb.py +++ b/server/fishtest/rundb.py @@ -612,7 +612,7 @@ def get_results(self, run, save_run=True): return results - def calc_itp(self, run): + def calc_itp(self, run, count): itp = run["args"]["throughput"] itp = max(min(itp, 500), 1) @@ -640,13 +640,8 @@ def calc_itp(self, run): bonus = min(n / x, 2) itp *= bonus - # Extra bonus for most promising LTCs at strong-gainer bounds - # if ( - # tc_ratio >= 3.0 - # and llr > 1.5 - # and run["args"].get("sprt", {}).get("elo0", 0) > 0 - # ): - # itp *= 1.2 # Max net bonus 2x + # Malus for too many active runs + itp *= 36.0 / (36.0 + count * count) run["args"]["itp"] = itp @@ -715,11 +710,20 @@ def sync_request_task(self, worker_info): if runs_finished or time.time() > self.task_time + 60: print("Request_task: refresh queue", flush=True) + + # list user names for active runs + user_active = [] + for r in self.get_unfinished_runs_id(): + run = self.get_run(r["_id"]) + if any(task["active"] for task in reversed(run["tasks"])): + user_active.append(run["args"].get("username")) + + # now compute their itp self.task_runs = [] for r in self.get_unfinished_runs_id(): run = self.get_run(r["_id"]) self.update_workers_cores(run) - self.calc_itp(run) + self.calc_itp(run, user_active.count(run["args"].get("username"))) self.task_runs.append(run) self.task_time = time.time()