From f453aa6fa0deba1f2c789b9e449f4f4f58729cea Mon Sep 17 00:00:00 2001 From: sebastiankloth Date: Fri, 30 Jun 2023 08:58:36 +0200 Subject: [PATCH] Removed except clause in shifted_correlation to always raise an exception. --- mdevaluate/correlation.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mdevaluate/correlation.py b/mdevaluate/correlation.py index 525a2f4..34b273f 100644 --- a/mdevaluate/correlation.py +++ b/mdevaluate/correlation.py @@ -192,17 +192,15 @@ def shifted_correlation( ) else: pool = ProcessPool(nodes=nodes) + # Use try finally instead of a context manager to ensure the pool is + # restarted in case of working in a jupyter-notebook, + # otherwise the kernel has to be restarted. try: result = np.array( pool.map( partial(get_correlation, idx=idx, selector=selector), start_frames ) ) - except Exception: - logger.warning( - "WARNING: Something went wrong during multiprocessing " - "in shifted_correlation." - ) finally: pool.terminate() pool.restart()