Since this thing is on the innerwebs I suppose it should have a
[python_utils.git] / tests / parallelize_itest.py
index 6ac95380c5a9a132fb7c43172d1a30d0ce59e2ee..ef154a70d92eb4a32339bc4eb5a121561878aa50 100755 (executable)
@@ -1,13 +1,20 @@
 #!/usr/bin/env python3
 
+# © Copyright 2021-2022, Scott Gasch
+
+"""parallelize unittest."""
+
+import logging
 import sys
 
 import bootstrap
-import parallelize as p
 import decorator_utils
 import executors
+import parallelize as p
 import smart_future
 
+logger = logging.getLogger(__name__)
+
 
 @p.parallelize(method=p.Method.THREAD)
 def compute_factorial_thread(n):
@@ -60,7 +67,7 @@ def test_process_parallelization() -> None:
 @decorator_utils.timed
 def test_remote_parallelization() -> None:
     results = []
-    for _ in range(50):
+    for _ in range(10):
         results.append(compute_factorial_remote(_))
     for result in smart_future.wait_any(results):
         print(result)
@@ -77,4 +84,8 @@ def main() -> None:
 
 
 if __name__ == '__main__':
-    main()
+    try:
+        main()
+    except Exception as e:
+        logger.exception(e)
+        sys.exit(1)