From 865825894beeedd47d26dd092d40bfee582f5475 Mon Sep 17 00:00:00 2001 From: Scott Date: Sun, 30 Jan 2022 21:29:34 -0800 Subject: Change locking boundaries for shared dict. Add a unit test. Make smart_futures re-raise exceptions that happened in futures. Mess with file_utils. --- smart_future.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'smart_future.py') diff --git a/smart_future.py b/smart_future.py index c96c5a7..2f3cbd9 100644 --- a/smart_future.py +++ b/smart_future.py @@ -40,8 +40,11 @@ def wait_any( if log_exceptions and not f.cancelled(): exception = f.exception() if exception is not None: + logger.warning( + f'Future {id(f)} raised an unhandled exception and exited.' + ) logger.exception(exception) - traceback.print_tb(exception.__traceback__) + raise exception yield smart_future_by_real_future[f] if callback is not None: callback() @@ -62,8 +65,11 @@ def wait_all( if not f.cancelled(): exception = f.exception() if exception is not None: + logger.warning( + f'Future {id(f)} raised an unhandled exception and exited.' + ) logger.exception(exception) - traceback.print_tb(exception.__traceback__) + raise exception assert len(done) == len(real_futures) assert len(not_done) == 0 -- cgit v1.3