Sometimes a cell needs some extra cleanup to be done when the Jupyter kernel is interrupted, such as closing specific threads it spawned etc.
afterCellExecution {} does not appear to be called in this case and when trying to use a finally block (piggybacking on the InterruptedException) in the integration code to make sure the other threads stop, this also gets interrupted (I think).
I, at least, was not able to get a working clean solution.
A block of code that can run after an interrupt of the kernel could solve this as it has some time to clean up and make sure any running process is stopped as well.
Sometimes a cell needs some extra cleanup to be done when the Jupyter kernel is interrupted, such as closing specific threads it spawned etc.
afterCellExecution {}
does not appear to be called in this case and when trying to use afinally
block (piggybacking on the InterruptedException) in the integration code to make sure the other threads stop, this also gets interrupted (I think). I, at least, was not able to get a working clean solution.A block of code that can run after an interrupt of the kernel could solve this as it has some time to clean up and make sure any running process is stopped as well.