Skip to content

Commit

Permalink
(fixes)
Browse files Browse the repository at this point in the history
  • Loading branch information
dubslow committed Feb 16, 2023
1 parent 7519b2f commit 0a38d45
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
13 changes: 8 additions & 5 deletions server/fishtest/rundb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down Expand Up @@ -1146,14 +1148,15 @@ 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"] != ""
)

# Return.

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)
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 6 additions & 4 deletions server/fishtest/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def task_purge_and_copy(task):
"crashes": 0,
"time_losses": 0,
"pentanomial": 5 * [0],
})
}
return purged_task


Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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)

0 comments on commit 0a38d45

Please sign in to comment.