File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 66import threading
77import time
88from collections import Counter , defaultdict
9- from concurrent .futures import ProcessPoolExecutor , as_completed
9+ from concurrent .futures import ProcessPoolExecutor , as_completed , wait , FIRST_COMPLETED
1010from datetime import datetime
1111from typing import Any , Dict , List , Tuple
1212from warnings import warn
@@ -204,14 +204,13 @@ def evaluate(flags):
204204 assert len (completion_id ) == len (problems ), "Missing problems in samples"
205205
206206 def stucking_checker ():
207- 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 } " )
207+ not_done = futures
208+ while len (not_done ) > 0 :
209+ done , not_done = wait (not_done , timeout = 240 , return_when = FIRST_COMPLETED )
210+
211+ if len (done ) == 0 :
212+ warn ("No samples have finished testing in the last 240s" )
213+ warn (f"{ len (remainings )} samples to be tested: { remainings } " )
215214
216215 threading .Thread (target = stucking_checker ).start ()
217216
You can’t perform that action at this time.
0 commit comments