Adds a __repr__ to graph.
[pyutils.git] / src / pyutils / parallelize / smart_future.py
index b722cfecb5d6e4b525bf5770ae1014634fd5d787..6da4db2da1c042030503903f6e9434f1b4e41494 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python3
 
-# © Copyright 2021-2022, Scott Gasch
+# © Copyright 2021-2023, Scott Gasch
 
 """
 A :class:`Future` that can be treated as a substutute for the result
@@ -79,11 +79,11 @@ def wait_any(
                 if log_exceptions and not f.cancelled():
                     exception = f.exception()
                     if exception is not None:
-                        logger.warning(
+                        logger.exception(
                             "Future 0x%x raised an unhandled exception and exited.",
                             id(f),
+                            exc_info=exception,
                         )
-                        logger.exception(exception)
                         raise exception
                 yield smart_future_by_real_future[f]
         except concurrent.futures.TimeoutError:
@@ -125,11 +125,11 @@ def wait_all(
             if not f.cancelled():
                 exception = f.exception()
                 if exception is not None:
-                    logger.warning(
+                    logger.exception(
                         "Future 0x%x raised an unhandled exception and exited.",
                         id(f),
+                        exc_info=exception,
                     )
-                    logger.exception(exception)
                     raise exception
     assert len(done) == len(real_futures)
     assert len(not_done) == 0