Skip to content

Commit 462599a

Browse files
authored
fix: score value race condition (#244)
* bugfix score value race condition * revert agent change
1 parent 558694f commit 462599a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

dreadnode/optimization/stop.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ def score_value(
6363
"""
6464

6565
def stop(trials: list[Trial]) -> bool: # noqa: PLR0911
66-
if not trials:
66+
finished_trials = [t for t in trials if t.status == "finished"]
67+
if not finished_trials:
6768
return False
6869

69-
trial = trials[-1]
70+
trial = finished_trials[-1]
7071
value_to_check = trial.scores.get(metric_name) if metric_name else trial.score
7172
if value_to_check is None:
7273
return False

0 commit comments

Comments
 (0)