Removed except clause in shifted_correlation to always raise an exception.

This commit is contained in:
sebastiankloth 2023-06-30 08:58:36 +02:00
parent 2125c4de47
commit f453aa6fa0

View File

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