Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Await futures in progress checker #48

Merged
merged 4 commits into from
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions bigcodebench/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import threading
import time
from collections import Counter, defaultdict
from concurrent.futures import ProcessPoolExecutor, as_completed
from concurrent.futures import ProcessPoolExecutor, as_completed, wait, FIRST_COMPLETED
from datetime import datetime
from typing import Any, Dict, List, Tuple
from warnings import warn
Expand Down Expand Up @@ -204,14 +204,13 @@ def evaluate(flags):
assert len(completion_id) == len(problems), "Missing problems in samples"

def stucking_checker():
while remainings:
last_size = len(remainings)
time.sleep(240)
if last_size != len(remainings) or len(remainings) == 0:
continue
# Potential stucking
warn("No samples had finished testing in the last 240s")
warn(f"{len(remainings)} samples to be tested: {remainings}")
not_done = futures
while len(not_done) > 0:
done, not_done = wait(not_done, timeout=240, return_when=FIRST_COMPLETED)

if len(done) == 0:
warn("No samples have finished testing in the last 240s")
warn(f"{len(remainings)} samples to be tested: {remainings}")

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

Expand Down