diff --git a/nornir_pools/poolbase.py b/nornir_pools/poolbase.py index c5d718a..5e29669 100644 --- a/nornir_pools/poolbase.py +++ b/nornir_pools/poolbase.py @@ -184,8 +184,12 @@ def remove_finished_threads(self): def wait_completion(self): - """Wait for completion of all the tasks in the queue""" + """Wait for completion of all the tasks in the queue. + Note that wait or wait_return must be called on + each task to detect exceptions if there were any + """ - self.tasks.join() + + self.tasks.join() self.remove_finished_threads() \ No newline at end of file diff --git a/test/test_nornir_pools.py b/test/test_nornir_pools.py index 532373e..8c0e830 100644 --- a/test/test_nornir_pools.py +++ b/test/test_nornir_pools.py @@ -94,12 +94,14 @@ def VerifyExceptionBehaviour(test, pool): try: task = pool.add_task(exceptText, RaiseException, exceptText) pool.wait_completion() + + task.wait(); except IntentionalPoolException as e: print("Correctly found exception in thread\n" + str(e)) ExceptionFound = True pass - test.assertTrue(ExceptionFound, "wait_return: No exception reported when raised in thread and pool.wait_completion called") + test.assertTrue(ExceptionFound, "wait_completion: No exception reported when raised in thread and pool.wait_completion called") def SquareTheNumberWithDelay(num):