@@ -28,7 +28,7 @@ class WorkerThreadHolder: # pylint: disable=too-many-instance-attributes
2828 thread : threading .Thread
2929 ppn : int
3030 load : float
31- devices : typing .Set [int ]
31+ devices : typing .Optional [ typing . Set [int ] ]
3232
3333
3434@dataclasses .dataclass
@@ -38,7 +38,7 @@ class Task:
3838 args : typing .List [typing .Any ]
3939 load : float
4040
41- def sched (tasks : typing .List [Task ], nThreads : int , devices : typing .Set [int ] = None ) -> None : # pylint: disable=too-many-locals,too-many-branches,too-many-statements
41+ def sched (tasks : typing .List [Task ], nThreads : int , devices : typing .Optional [ typing . Set [int ] ] = None ) -> None : # pylint: disable=too-many-locals,too-many-branches,too-many-statements
4242 nAvailable : int = nThreads
4343 threads : typing .List [WorkerThreadHolder ] = []
4444
@@ -70,16 +70,11 @@ def join_first_dead_thread(progress, complete_tracker) -> None:
7070 # Check for and propagate any exceptions that occurred in the worker thread
7171 # But only if the worker function didn't complete successfully
7272 # (This allows test failures to be handled gracefully by handle_case)
73- if threadHolder .thread .exc is not None :
74- if threadHolder .thread .completed_successfully :
75- # Test framework handled the exception gracefully (e.g., test failure)
76- # Don't re-raise - this is expected behavior
77- pass
78- elif hasattr (threadHolder .thread , 'exc_info' ) and threadHolder .thread .exc_info :
79- # Unhandled exception - this indicates a real problem
73+ if threadHolder .thread .exc is not None and not threadHolder .thread .completed_successfully :
74+ # Unhandled exception - propagate with full traceback if available
75+ if hasattr (threadHolder .thread , 'exc_info' ) and threadHolder .thread .exc_info :
8076 error_msg = f"Worker thread { threadID } failed with unhandled exception:\n { threadHolder .thread .exc_info } "
8177 raise RuntimeError (error_msg ) from threadHolder .thread .exc
82-
8378 raise threadHolder .thread .exc
8479
8580 nAvailable += threadHolder .ppn
0 commit comments