Skip to content

Commit ad3e087

Browse files
committed
Increase frequency of progress checker
1 parent e71fe2e commit ad3e087

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

bigcodebench/evaluate.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,26 @@ def evaluate(flags):
204204
assert len(completion_id) == len(problems), "Missing problems in samples"
205205

206206
def stucking_checker():
207+
unchanged_duration = 0
208+
last_size = len(remainings)
209+
207210
while remainings:
208-
last_size = len(remainings)
209-
time.sleep(240)
210-
if last_size != len(remainings) or len(remainings) == 0:
211-
continue
212-
# Potential stucking
213-
warn("No samples had finished testing in the last 240s")
214-
warn(f"{len(remainings)} samples to be tested: {remainings}")
211+
time.sleep(1)
212+
current_size = len(remainings)
213+
214+
if current_size != last_size or current_size == 0:
215+
# Reset the unchanged duration if something has changed
216+
unchanged_duration = 0
217+
last_size = current_size
218+
else:
219+
# Increment the duration if nothing has changed
220+
unchanged_duration += 1
221+
222+
if unchanged_duration >= 240:
223+
# Output warnings after 240 seconds of no change
224+
warn("No samples have finished testing in the last 240s")
225+
warn(f"{len(remainings)} samples to be tested: {remainings}")
226+
unchanged_duration = 0 # Reset after warning
215227

216228
threading.Thread(target=stucking_checker).start()
217229

0 commit comments

Comments
 (0)