Skip to content

Commit 7dfabd8

Browse files
committed
fix lint
1 parent 10dd27a commit 7dfabd8

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

toolchain/mfc/sched.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,23 @@ def join_first_dead_thread(progress, complete_tracker) -> None:
5050
for threadID, threadHolder in enumerate(threads):
5151
# Check if thread is not alive OR if it's been running for too long
5252
thread_not_alive = not threadHolder.thread.is_alive()
53-
53+
5454
if thread_not_alive:
5555
# Properly join the thread with timeout to prevent infinite hangs
5656
try:
5757
threadHolder.thread.join(timeout=30.0) # 30 second timeout
58-
58+
5959
# Double-check that thread actually finished joining
6060
if threadHolder.thread.is_alive():
6161
# Thread didn't finish within timeout - this is a serious issue
62-
raise Exception(f"Thread {threadID} failed to join within 30 seconds timeout. "
63-
f"Thread may be hung or in an inconsistent state.")
64-
62+
raise RuntimeError(f"Thread {threadID} failed to join within 30 seconds timeout. "
63+
f"Thread may be hung or in an inconsistent state.")
64+
6565
except Exception as join_exc:
6666
# Handle join-specific exceptions with more context
67-
raise Exception(f"Failed to join thread {threadID}: {join_exc}. "
68-
f"This may indicate a system threading issue or hung test case.")
69-
67+
raise RuntimeError(f"Failed to join thread {threadID}: {join_exc}. "
68+
f"This may indicate a system threading issue or hung test case.") from join_exc
69+
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)
@@ -75,13 +75,12 @@ def join_first_dead_thread(progress, complete_tracker) -> None:
7575
# Test framework handled the exception gracefully (e.g., test failure)
7676
# Don't re-raise - this is expected behavior
7777
pass
78+
# Unhandled exception - this indicates a real problem
79+
elif hasattr(threadHolder.thread, 'exc_info') and threadHolder.thread.exc_info:
80+
error_msg = f"Worker thread {threadID} failed with unhandled exception:\n{threadHolder.thread.exc_info}"
81+
raise RuntimeError(error_msg) from threadHolder.thread.exc
7882
else:
79-
# Unhandled exception - this indicates a real problem
80-
if hasattr(threadHolder.thread, 'exc_info') and threadHolder.thread.exc_info:
81-
error_msg = f"Worker thread {threadID} failed with unhandled exception:\n{threadHolder.thread.exc_info}"
82-
raise Exception(error_msg) from threadHolder.thread.exc
83-
else:
84-
raise threadHolder.thread.exc
83+
raise threadHolder.thread.exc
8584

8685
nAvailable += threadHolder.ppn
8786
for device in threadHolder.devices or set():

0 commit comments

Comments
 (0)