From 0a38d45c5951d9df788d6c9f09ca5592612e36fb Mon Sep 17 00:00:00 2001 From: Dubslow Date: Thu, 16 Feb 2023 07:01:05 -0600 Subject: [PATCH] (fixes) --- server/fishtest/rundb.py | 13 ++++++++----- server/fishtest/util.py | 10 ++++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/server/fishtest/rundb.py b/server/fishtest/rundb.py index d80b46192..2a79560be 100644 --- a/server/fishtest/rundb.py +++ b/server/fishtest/rundb.py @@ -997,10 +997,12 @@ def finished_run_message(self, run): def handle_crash_or_time(self, run, task_id): purged = False task = run["tasks"][task_id] - worker = task["worker_info"]["unique_key"] - history = self.worker_runs[worker].get("crash_time_history", None) # Caution, we don't always have the proper lock for this! + worker = self.worker_runs.get(task["worker_info"]["unique_key"], None) + if worker is None: + worker = self.worker_runs[task["worker_info"]["unique_key"]] = {} + history = worker.get("crash_time_history", None) # Caution, we don't always have the proper lock for this! if history is None: - history = self.worker_runs[worker]["crash_time_history"] = BinaryHistory(8) + history = worker["crash_time_history"] = BinaryHistory(8) if crash_or_time(task): stats = task.get("stats", {}) total = ( @@ -1146,7 +1148,7 @@ def count_games(d): # Check if the run is finished. run_finished = ( - count_games(updated_results) >= run["args"]["num_games"]: + count_games(updated_results) >= run["args"]["num_games"] or "sprt" in run["args"] and sprt["state"] != "" ) @@ -1154,6 +1156,7 @@ def count_games(d): if run_finished: if not task_finished: + task["active"] = False self.handle_crash_or_time(run, task_id) self.buffer(run, True) self.stop_run(run_id) @@ -1278,7 +1281,7 @@ def purge_run(self, run, p=0.001, res=7.0, iters=1): update_residuals(run["tasks"], chi2=chi2) # Marks residual color (and calls crash_or_time, marking such failures not already caught) bad_workers = get_bad_workers_by_residual( run["tasks"], - chi2=chi2, + first_chi2=chi2, p=p, res=res, iters=iters - 1 if message == "" else iters, diff --git a/server/fishtest/util.py b/server/fishtest/util.py index 6f009427c..9f0010a83 100644 --- a/server/fishtest/util.py +++ b/server/fishtest/util.py @@ -66,7 +66,7 @@ def task_purge_and_copy(task): "crashes": 0, "time_losses": 0, "pentanomial": 5 * [0], - }) + } return purged_task @@ -211,12 +211,14 @@ def update_residuals(tasks, chi2=None): task_mark_excessive_residual(task) -def get_bad_workers_by_residual(tasks, chi2=None, p=0.001, res=7.0, iters=1): +def get_bad_workers_by_residual(tasks, first_chi2=None, p=0.001, res=7.0, iters=1): # If we have an up-to-date result of get_chi2(), pass it to avoid needless # recomputation. bad_workers = set() for _ in range(iters): - if chi2 is None: + if first_chi2: + chi2, first_chi2 = first_chi2, None + else: chi2 = get_chi2(tasks, exclude_workers=bad_workers) worst_user = {} residuals = chi2["residual"] @@ -561,4 +563,4 @@ def update(self, bit): self._l[self._i] = bool(bit) self._i = (self._i + 1) % self._n def sum(self): - return sum(self._;) + return sum(self._l)