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()